protected function getValue()
{
$response = $this->client->getConnection()->read();
switch ($response[0]) {
case self::SUBSCRIBE:
case self::UNSUBSCRIBE:
case self::PSUBSCRIBE:
case self::PUNSUBSCRIBE:
if ($response[2] === 0) {
$this->invalidate();
}
// The missing break here is intentional as we must process
// subscriptions and unsubscriptions as standard messages.
// no break
// The missing break here is intentional as we must process
// subscriptions and unsubscriptions as standard messages.
// no break
case self::MESSAGE:
return (object) array('kind' => $response[0], 'channel' => $response[1], 'payload' => $response[2]);
case self::PMESSAGE:
return (object) array('kind' => $response[0], 'pattern' => $response[1], 'channel' => $response[2], 'payload' => $response[3]);
case self::PONG:
return (object) array('kind' => $response[0], 'payload' => $response[1]);
default:
throw new ClientException("Unknown message type '{$response[0]}' received in the PUB/SUB context.");
}
}