logger = $logger; $this->channel = "#issue:synapse"; $this->client = new MatrixClient("http://synapse:8008"); $this->token = $this->client->login("upschooling", "secret"); // try { // $this->room = $this->client->createRoom($this->channel, false, array()); // } catch (MatrixException $createE) { // try { // $this->room = $this->client->joinRoom($this->channel); // } catch (MatrixException $e) { // $this->logger->error( // "Could not create room ".$this->channel, // array('exception' => $e, 'causedBy' => $createE) // ); // } // } } /** * Sets a property on a channel. * * @param string $eventType a unique property identifier with reverse domain notation, e.g. com.example.property. * @param array $content the contents as a JSON serializable array. * @throws MatrixException */ public function setProperty(string $eventType, array $content) { $this->room->sendStateEvent($eventType, $content); } /** * @param string $eventType a unique property identifier with reverse domain notation, e.g. com.example.property. * @return array the contents of the room state. * @throws MatrixException|MatrixRequestException */ public function getProperty(string $eventType): array { // first parameter should be $this->room->roomId return $this->client->api()->getStateEvent($this->channel, $eventType); } }