Example #1
0
 /**
  * Checks if the passed client instance satisfies the required conditions
  * needed to initialize a monitor context.
  *
  * @param Client Client instance used by the context.
  */
 private function checkCapabilities(Client $client)
 {
     if (Helpers::isCluster($client->getConnection())) {
         throw new ClientException('Cannot initialize a monitor context over a cluster of connections');
     }
     if ($client->getProfile()->supportsCommand('monitor') === false) {
         throw new ClientException('The current profile does not support the MONITOR command');
     }
 }
Example #2
0
 /**
  * Checks if the passed client instance satisfies the required conditions
  * needed to initialize a Publish / Subscribe context.
  *
  * @param Client Client instance used by the context.
  */
 private function checkCapabilities(Client $client)
 {
     if (Helpers::isCluster($client->getConnection())) {
         throw new ClientException('Cannot initialize a PUB/SUB context over a cluster of connections');
     }
     $commands = array('publish', 'subscribe', 'unsubscribe', 'psubscribe', 'punsubscribe');
     if ($client->getProfile()->supportsCommands($commands) === false) {
         throw new ClientException('The current profile does not support PUB/SUB related commands');
     }
 }