mirror of
https://github.com/predis/predis.git
synced 2026-08-31 12:43:31 +00:00
Rename the Predis\Protocols namespace to Predis\Protocol.
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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
-1
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Predis\Protocols;
|
||||
namespace Predis\Protocol;
|
||||
|
||||
use Predis\Commands\ICommand;
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Predis\Protocols;
|
||||
namespace Predis\Protocol;
|
||||
|
||||
interface IComposableProtocolProcessor extends IProtocolProcessor {
|
||||
public function setSerializer(ICommandSerializer $serializer);
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Predis\Protocols;
|
||||
namespace Predis\Protocol;
|
||||
|
||||
use Predis\Commands\ICommand;
|
||||
use Predis\Network\IConnectionComposable;
|
||||
+1
-1
@@ -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;
|
||||
|
||||
+4
-4
@@ -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 {
|
||||
+2
-2
@@ -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 {
|
||||
+2
-2
@@ -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 {
|
||||
+2
-2
@@ -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 {
|
||||
+2
-2
@@ -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 {
|
||||
+2
-2
@@ -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 {
|
||||
+2
-2
@@ -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;
|
||||
|
||||
+2
-2
@@ -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 {
|
||||
+2
-2
@@ -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) {
|
||||
+2
-2
@@ -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;
|
||||
|
||||
+3
-3
@@ -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
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user