public static function updateChannelInfo(UserCollection $userCollection, ChannelsCollection $channels) { foreach ($channels->getChannels() as $channel) { $response = (new ChannelsResponse())->setChannels($channels)->setChannelId($channel->getId()); $userCollection->setResponse($response)->notify(false); } }
public function setChannels(ChannelsCollection $channels) { $users = DI::get()->getUsers(); foreach ($channels->getChannels() as $channel) { if (!$channel->isPrivate()) { $this->channels[$channel->getId()] = ['name' => $channel->getName(), 'usersCount' => $users->getClientsCount($channel->getId())]; } } return $this; }