Exemplo n.º 1
0
 /**
  * Creates a channel if it does not exist and returns it.
  * If channel exists it is just returned.
  *
  * @param string $channelName
  *
  * @return WiseChatChannel
  */
 public function createAndGetChannel($channelName)
 {
     $channel = $this->channelsDAO->getByName($channelName);
     if ($channel === null) {
         $channel = new WiseChatChannel();
         $channel->setName($channelName);
         $this->channelsDAO->save($channel);
     }
     return $channel;
 }
Exemplo n.º 2
0
 /**
  * Converts raw object into WiseChatChannel object.
  *
  * @param stdClass $rawChannelData
  *
  * @return WiseChatChannel
  */
 private function populateChannelData($rawChannelData)
 {
     $channel = new WiseChatChannel();
     if ($rawChannelData->id > 0) {
         $channel->setId(intval($rawChannelData->id));
     }
     $channel->setName($rawChannelData->name);
     $channel->setPassword($rawChannelData->password);
     return $channel;
 }