Rename the Predis\Protocols namespace to Predis\Protocol.

This commit is contained in:
Daniele Alessandri
2011-06-04 15:45:01 +02:00
parent 667ce97213
commit d59556cae1
19 changed files with 46 additions and 46 deletions
@@ -5,8 +5,8 @@ namespace Predis\Network;
use Predis\IConnectionParameters;
use Predis\CommunicationException;
use Predis\Commands\ICommand;
use Predis\Protocols\IProtocolProcessor;
use Predis\Protocols\Text\TextProtocol;
use Predis\Protocol\IProtocolProcessor;
use Predis\Protocol\Text\TextProtocol;
class ComposableStreamConnection extends StreamConnection implements IConnectionComposable {
private $_protocol;
+1 -1
View File
@@ -2,7 +2,7 @@
namespace Predis\Network;
use Predis\Protocols\IProtocolProcessor;
use Predis\Protocol\IProtocolProcessor;
interface IConnectionComposable extends IConnectionSingle {
public function setProtocol(IProtocolProcessor $protocol);
@@ -1,6 +1,6 @@
<?php
namespace Predis\Protocols;
namespace Predis\Protocol;
use Predis\Commands\ICommand;
@@ -1,6 +1,6 @@
<?php
namespace Predis\Protocols;
namespace Predis\Protocol;
interface IComposableProtocolProcessor extends IProtocolProcessor {
public function setSerializer(ICommandSerializer $serializer);
@@ -1,6 +1,6 @@
<?php
namespace Predis\Protocols;
namespace Predis\Protocol;
use Predis\Commands\ICommand;
use Predis\Network\IConnectionComposable;
@@ -1,6 +1,6 @@
<?php
namespace Predis\Protocols;
namespace Predis\Protocol;
use Predis\Network\IConnectionComposable;
@@ -1,6 +1,6 @@
<?php
namespace Predis\Protocols;
namespace Predis\Protocol;
use Predis\Network\IConnectionComposable;
@@ -1,11 +1,11 @@
<?php
namespace Predis\Protocols\Text;
namespace Predis\Protocol\Text;
use Predis\Commands\ICommand;
use Predis\Protocols\IResponseReader;
use Predis\Protocols\ICommandSerializer;
use Predis\Protocols\IComposableProtocolProcessor;
use Predis\Protocol\IResponseReader;
use Predis\Protocol\ICommandSerializer;
use Predis\Protocol\IComposableProtocolProcessor;
use Predis\Network\IConnectionComposable;
class ComposableTextProtocol implements IComposableProtocolProcessor {
@@ -1,10 +1,10 @@
<?php
namespace Predis\Protocols\Text;
namespace Predis\Protocol\Text;
use Predis\Helpers;
use Predis\ProtocolException;
use Predis\Protocols\IResponseHandler;
use Predis\Protocol\IResponseHandler;
use Predis\Network\IConnectionComposable;
class ResponseBulkHandler implements IResponseHandler {
@@ -1,9 +1,9 @@
<?php
namespace Predis\Protocols\Text;
namespace Predis\Protocol\Text;
use Predis\ServerException;
use Predis\Protocols\IResponseHandler;
use Predis\Protocol\IResponseHandler;
use Predis\Network\IConnectionComposable;
class ResponseErrorHandler implements IResponseHandler {
@@ -1,9 +1,9 @@
<?php
namespace Predis\Protocols\Text;
namespace Predis\Protocol\Text;
use Predis\ResponseError;
use Predis\Protocols\IResponseHandler;
use Predis\Protocol\IResponseHandler;
use Predis\Network\IConnectionComposable;
class ResponseErrorSilentHandler implements IResponseHandler {
@@ -1,10 +1,10 @@
<?php
namespace Predis\Protocols\Text;
namespace Predis\Protocol\Text;
use Predis\Helpers;
use Predis\ProtocolException;
use Predis\Protocols\IResponseHandler;
use Predis\Protocol\IResponseHandler;
use Predis\Network\IConnectionComposable;
class ResponseIntegerHandler implements IResponseHandler {
@@ -1,10 +1,10 @@
<?php
namespace Predis\Protocols\Text;
namespace Predis\Protocol\Text;
use Predis\Helpers;
use Predis\ProtocolException;
use Predis\Protocols\IResponseHandler;
use Predis\Protocol\IResponseHandler;
use Predis\Network\IConnectionComposable;
class ResponseMultiBulkHandler implements IResponseHandler {
@@ -1,10 +1,10 @@
<?php
namespace Predis\Protocols\Text;
namespace Predis\Protocol\Text;
use Predis\Helpers;
use Predis\ProtocolException;
use Predis\Protocols\IResponseHandler;
use Predis\Protocol\IResponseHandler;
use Predis\Network\IConnectionComposable;
use Predis\Iterators\MultiBulkResponseSimple;
@@ -1,9 +1,9 @@
<?php
namespace Predis\Protocols\Text;
namespace Predis\Protocol\Text;
use Predis\ResponseQueued;
use Predis\Protocols\IResponseHandler;
use Predis\Protocol\IResponseHandler;
use Predis\Network\IConnectionComposable;
class ResponseStatusHandler implements IResponseHandler {
@@ -1,9 +1,9 @@
<?php
namespace Predis\Protocols\Text;
namespace Predis\Protocol\Text;
use Predis\Commands\ICommand;
use Predis\Protocols\ICommandSerializer;
use Predis\Protocol\ICommandSerializer;
class TextCommandSerializer implements ICommandSerializer {
public function serialize(ICommand $command) {
@@ -1,6 +1,6 @@
<?php
namespace Predis\Protocols\Text;
namespace Predis\Protocol\Text;
use Predis\Helpers;
use Predis\ResponseError;
@@ -8,7 +8,7 @@ use Predis\ResponseQueued;
use Predis\ServerException;
use Predis\ProtocolException;
use Predis\Commands\ICommand;
use Predis\Protocols\IProtocolProcessor;
use Predis\Protocol\IProtocolProcessor;
use Predis\Network\IConnectionComposable;
use Predis\Iterators\MultiBulkResponseSimple;
@@ -1,11 +1,11 @@
<?php
namespace Predis\Protocols\Text;
namespace Predis\Protocol\Text;
use Predis\Helpers;
use Predis\ProtocolException;
use Predis\Protocols\IResponseReader;
use Predis\Protocols\IResponseHandler;
use Predis\Protocol\IResponseReader;
use Predis\Protocol\IResponseHandler;
use Predis\Network\IConnectionComposable;
class TextResponseReader implements IResponseReader {
+13 -13
View File
@@ -158,7 +158,7 @@ class ClientFeaturesTestSuite extends PHPUnit_Framework_TestCase {
function testResponseQueued() {
$response = new \Predis\ResponseQueued();
$this->assertInstanceOf('\Predis\IReplyObject', $response);
$this->assertEquals(\Predis\Protocols\Text\TextProtocol::QUEUED, (string)$response);
$this->assertEquals(\Predis\Protocol\Text\TextProtocol::QUEUED, (string)$response);
}
@@ -273,30 +273,30 @@ class ClientFeaturesTestSuite extends PHPUnit_Framework_TestCase {
}
/* Predis\Protocols\TextResponseReader */
/* Predis\Protocol\TextResponseReader */
function testResponseReader_OptionIterableMultiBulkReplies() {
$protocol = new Predis\Protocols\Text\ComposableTextProtocol();
$protocol = new Predis\Protocol\Text\ComposableTextProtocol();
$reader = $protocol->getReader();
$connection = new \Predis\Network\ComposableStreamConnection(RC::getConnectionParameters(), $protocol);
$reader->setHandler(
\Predis\Protocols\Text\TextProtocol::PREFIX_MULTI_BULK,
new \Predis\Protocols\Text\ResponseMultiBulkHandler()
\Predis\Protocol\Text\TextProtocol::PREFIX_MULTI_BULK,
new \Predis\Protocol\Text\ResponseMultiBulkHandler()
);
$connection->writeBytes("KEYS *\r\n");
$this->assertInternalType('array', $reader->read($connection));
$reader->setHandler(
\Predis\Protocols\Text\TextProtocol::PREFIX_MULTI_BULK,
new \Predis\Protocols\Text\ResponseMultiBulkStreamHandler()
\Predis\Protocol\Text\TextProtocol::PREFIX_MULTI_BULK,
new \Predis\Protocol\Text\ResponseMultiBulkStreamHandler()
);
$connection->writeBytes("KEYS *\r\n");
$this->assertInstanceOf('\Iterator', $reader->read($connection));
}
function testResponseReader_OptionExceptionOnError() {
$protocol = new Predis\Protocols\Text\ComposableTextProtocol();
$protocol = new Predis\Protocol\Text\ComposableTextProtocol();
$reader = $protocol->getReader();
$connection = new \Predis\Network\ComposableStreamConnection(RC::getConnectionParameters(), $protocol);
@@ -305,8 +305,8 @@ class ClientFeaturesTestSuite extends PHPUnit_Framework_TestCase {
$reader->read($connection);
$reader->setHandler(
\Predis\Protocols\Text\TextProtocol::PREFIX_ERROR,
new \Predis\Protocols\Text\ResponseErrorSilentHandler()
\Predis\Protocol\Text\TextProtocol::PREFIX_ERROR,
new \Predis\Protocol\Text\ResponseErrorSilentHandler()
);
$connection->writeBytes($rawCmdUnexpected);
$errorReply = $reader->read($connection);
@@ -314,8 +314,8 @@ class ClientFeaturesTestSuite extends PHPUnit_Framework_TestCase {
$this->assertEquals(RC::EXCEPTION_WRONG_TYPE, $errorReply->getMessage());
$reader->setHandler(
\Predis\Protocols\Text\TextProtocol::PREFIX_ERROR,
new \Predis\Protocols\Text\ResponseErrorHandler()
\Predis\Protocol\Text\TextProtocol::PREFIX_ERROR,
new \Predis\Protocol\Text\ResponseErrorHandler()
);
RC::testForServerException($this, RC::EXCEPTION_WRONG_TYPE, function()
use ($connection, $rawCmdUnexpected) {
@@ -326,7 +326,7 @@ class ClientFeaturesTestSuite extends PHPUnit_Framework_TestCase {
}
function testResponseReader_EmptyBulkResponse() {
$protocol = new \Predis\Protocols\Text\ComposableTextProtocol();
$protocol = new \Predis\Protocol\Text\ComposableTextProtocol();
$connection = new \Predis\Network\ComposableStreamConnection(RC::getConnectionParameters(), $protocol);
$client = new \Predis\Client($connection);