Remove almost useless method.

This commit is contained in:
Daniele Alessandri
2012-04-28 09:23:41 +02:00
parent 2d0b30dac5
commit 214b7d2dc9
5 changed files with 20 additions and 43 deletions
+1 -14
View File
@@ -30,16 +30,14 @@ abstract class AbstractConnection implements SingleConnectionInterface
private $cachedId;
protected $parameters;
protected $initCmds;
protected $initCmds = array();
/**
* @param ConnectionParametersInterface $parameters Parameters used to initialize the connection.
*/
public function __construct(ConnectionParametersInterface $parameters)
{
$this->initCmds = array();
$this->parameters = $this->checkParameters($parameters);
$this->initializeProtocol($parameters);
}
/**
@@ -72,17 +70,6 @@ abstract class AbstractConnection implements SingleConnectionInterface
}
}
/**
* Initializes some common configurations of the underlying protocol processor
* from the connection parameters.
*
* @param ConnectionParametersInterface $parameters Parameters used to initialize the connection.
*/
protected function initializeProtocol(ConnectionParametersInterface $parameters)
{
// NOOP
}
/**
* Creates the underlying resource used to communicate with Redis.
*
@@ -32,17 +32,11 @@ class ComposableStreamConnection extends StreamConnection implements ComposableC
*/
public function __construct(ConnectionParametersInterface $parameters, ProtocolInterface $protocol = null)
{
$this->setProtocol($protocol ?: new TextProtocol());
$protocol = $protocol ?: new TextProtocol();
$protocol->setOption('iterable_multibulk', $parameters->iterable_multibulk);
parent::__construct($parameters);
}
/**
* {@inheritdoc}
*/
protected function initializeProtocol(ConnectionParametersInterface $parameters)
{
$this->protocol->setOption('iterable_multibulk', $parameters->iterable_multibulk);
$this->protocol = $protocol;
$this->parameters = $this->checkParameters($parameters);
}
/**
@@ -57,6 +57,7 @@ class PhpiredisConnection extends AbstractConnection
public function __construct(ConnectionParametersInterface $parameters)
{
$this->checkExtensions();
$this->initializeReader();
parent::__construct($parameters);
}
@@ -113,14 +114,6 @@ class PhpiredisConnection extends AbstractConnection
$this->reader = $reader;
}
/**
* {@inheritdoc}
*/
protected function initializeProtocol(ConnectionParametersInterface $parameters)
{
$this->initializeReader();
}
/**
* Gets the handler used by the protocol reader to handle status replies.
*
@@ -392,6 +385,7 @@ class PhpiredisConnection extends AbstractConnection
*/
public function __wakeup()
{
$this->initializeProtocol($this->getParameters());
$this->checkExtensions();
$this->initializeReader();
}
}
+10 -8
View File
@@ -37,6 +37,16 @@ class StreamConnection extends AbstractConnection
{
private $mbiterable;
/**
* {@inheritdoc}
*/
public function __construct(ConnectionParametersInterface $parameters)
{
$this->mbiterable = (bool) $parameters->iterable_multibulk;
parent::__construct($parameters);
}
/**
* Disconnects from the server and destroys the underlying resource when
* PHP's garbage collector kicks in only if the connection has not been
@@ -49,14 +59,6 @@ class StreamConnection extends AbstractConnection
}
}
/**
* {@inheritdoc}
*/
protected function initializeProtocol(ConnectionParametersInterface $parameters)
{
$this->mbiterable = (bool) $parameters->iterable_multibulk;
}
/**
* {@inheritdoc}
*/
+2 -2
View File
@@ -57,13 +57,13 @@ class WebdisConnection implements SingleConnectionInterface
*/
public function __construct(ConnectionParametersInterface $parameters)
{
$this->parameters = $parameters;
$this->checkExtensions();
if ($parameters->scheme !== 'http') {
throw new \InvalidArgumentException("Invalid scheme: {$parameters->scheme}");
}
$this->checkExtensions();
$this->parameters = $parameters;
$this->resource = $this->initializeCurl($parameters);
$this->reader = $this->initializeReader($parameters);
}