From dd50cfe47e63ad7ab2d2f855ecd2b7508662c0ce Mon Sep 17 00:00:00 2001 From: Daniele Alessandri Date: Fri, 31 May 2013 10:17:54 +0200 Subject: [PATCH] Slightly rework original pull request. --- lib/Predis/PubSub/DispatcherLoop.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/Predis/PubSub/DispatcherLoop.php b/lib/Predis/PubSub/DispatcherLoop.php index d6f4ae20..a06036a0 100644 --- a/lib/Predis/PubSub/DispatcherLoop.php +++ b/lib/Predis/PubSub/DispatcherLoop.php @@ -21,7 +21,6 @@ use Predis\ClientInterface; */ class DispatcherLoop { - private $client; private $pubSubContext; private $callbacks; private $defaultCallback; @@ -33,7 +32,6 @@ class DispatcherLoop public function __construct(ClientInterface $client) { $this->callbacks = array(); - $this->client = $client; $this->pubSubContext = $client->pubSub(); } @@ -160,8 +158,12 @@ class DispatcherLoop */ protected function getPrefixKeys() { - $prefix = $this->client->getOptions()->prefix; + $options = $this->pubSubContext->getClient()->getOptions(); - return $prefix ? $prefix->getPrefix() : ''; + if (isset($options->prefix)) { + return $options->prefix->getPrefix(); + } + + return ''; } }