/** * Determine if a client is in the room * * @param Client $client The client to test * * @return bool True if the client is in the room, false otherwise */ public function isClientInTheRoom(Client $client) : bool { return $this->room->getClients()->isClientExist($client) !== null; }
/** * Change a user right in a room to display it in the admin panel * * @param Room $room The room where the right has been updated * @param Client $client The client who got a right changed * * @return \Generator */ public function changeUserRight(Room $room, Client $client) { $clientRight = $client->getUser()->getRoomRight()->getEntityById($room->id)->__toArray(); foreach ($room->getClients() as $roomClient) { if ($roomClient->isRegistered()) { (yield $roomClient->getConnection()->send(json_encode(['service' => $this->serviceName, 'action' => 'updateRoom', 'roomId' => $room->id, 'changedRight' => $clientRight]))); } } }