mirror of
https://github.com/predis/predis.git
synced 2026-08-31 12:43:31 +00:00
Fix a few oversights.
This commit is contained in:
@@ -34,6 +34,7 @@ When used in a project or script without PSR-0 autoloading, Predis includes its
|
||||
``` php
|
||||
<?php
|
||||
require PREDIS_BASE_PATH . '/Autoloader.php';
|
||||
|
||||
Predis\Autoloader::register();
|
||||
|
||||
// You can now create a Predis\Client, and use other Predis classes, without
|
||||
|
||||
+11
-11
@@ -4,13 +4,13 @@ namespace Predis;
|
||||
|
||||
class Autoloader
|
||||
{
|
||||
private $base_directory;
|
||||
private $prefix;
|
||||
private $_baseDir;
|
||||
private $_prefix;
|
||||
|
||||
public function __construct($base_directory = null)
|
||||
public function __construct($baseDirectory = null)
|
||||
{
|
||||
$this->base_directory = $base_directory ?: dirname(__FILE__);
|
||||
$this->prefix = __NAMESPACE__ . '\\';
|
||||
$this->_baseDir = $baseDirectory ?: dirname(__FILE__);
|
||||
$this->_prefix = __NAMESPACE__ . '\\';
|
||||
}
|
||||
|
||||
public static function register()
|
||||
@@ -18,18 +18,18 @@ class Autoloader
|
||||
spl_autoload_register(array(new self, 'autoload'));
|
||||
}
|
||||
|
||||
public function autoload($class_name)
|
||||
public function autoload($className)
|
||||
{
|
||||
if (0 !== strpos($class_name, $this->prefix)) {
|
||||
if (0 !== strpos($className, $this->_prefix)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$relative_class_name = substr($class_name, strlen($this->prefix));
|
||||
$class_name_parts = explode('\\', $relative_class_name);
|
||||
$relativeClassName = substr($className, strlen($this->_prefix));
|
||||
$classNameParts = explode('\\', $relativeClassName);
|
||||
|
||||
$path = $this->base_directory .
|
||||
$path = $this->_baseDir .
|
||||
DIRECTORY_SEPARATOR .
|
||||
implode(DIRECTORY_SEPARATOR, $class_name_parts) .
|
||||
implode(DIRECTORY_SEPARATOR, $classNameParts) .
|
||||
'.php';
|
||||
|
||||
require_once $path;
|
||||
|
||||
@@ -10,7 +10,8 @@ use Predis\Profiles\ServerProfile;
|
||||
use Predis\Pipeline\PipelineContext;
|
||||
use Predis\Transaction\MultiExecContext;
|
||||
|
||||
class Client {
|
||||
class Client
|
||||
{
|
||||
const VERSION = '0.7.0-dev';
|
||||
|
||||
private $_options;
|
||||
@@ -38,19 +39,15 @@ class Client {
|
||||
if ($options === null) {
|
||||
return new ClientOptions();
|
||||
}
|
||||
|
||||
if (is_array($options)) {
|
||||
return new ClientOptions($options);
|
||||
}
|
||||
|
||||
if ($options instanceof ClientOptions) {
|
||||
return $options;
|
||||
}
|
||||
|
||||
if ($options instanceof IServerProfile) {
|
||||
return new ClientOptions(array('profile' => $options));
|
||||
}
|
||||
|
||||
if (is_string($options)) {
|
||||
return new ClientOptions(array('profile' => ServerProfile::get($options)));
|
||||
}
|
||||
@@ -180,9 +177,11 @@ class Client {
|
||||
{
|
||||
if (Helpers::isCluster($this->_connection)) {
|
||||
$replies = array();
|
||||
|
||||
foreach ($this->_connection as $connection) {
|
||||
$replies[] = $connection->executeCommand($command);
|
||||
}
|
||||
|
||||
return $replies;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
|
||||
namespace Predis\Commands;
|
||||
|
||||
class KeyRename extends Command {
|
||||
class KeyRename extends Command
|
||||
{
|
||||
public function getId()
|
||||
{
|
||||
return 'RENAME';
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
|
||||
namespace Predis\Commands;
|
||||
|
||||
class StringSetMultiplePreserve extends StringSetMultiple {
|
||||
class StringSetMultiplePreserve extends StringSetMultiple
|
||||
{
|
||||
public function getId()
|
||||
{
|
||||
return 'MSETNX';
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
|
||||
namespace Predis\Commands;
|
||||
|
||||
class StringSetPreserve extends Command {
|
||||
class StringSetPreserve extends Command
|
||||
{
|
||||
public function getId()
|
||||
{
|
||||
return 'SETNX';
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
|
||||
namespace Predis\Options;
|
||||
|
||||
class CustomOption implements IOption {
|
||||
class CustomOption implements IOption
|
||||
{
|
||||
private $_validate;
|
||||
private $_default;
|
||||
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
|
||||
namespace Predis\Profiles;
|
||||
|
||||
class ServerVersion22 extends ServerProfile {
|
||||
class ServerVersion22 extends ServerProfile
|
||||
{
|
||||
public function getVersion()
|
||||
{
|
||||
return '2.2';
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
|
||||
namespace Predis\Profiles;
|
||||
|
||||
class ServerVersion24 extends ServerProfile {
|
||||
class ServerVersion24 extends ServerProfile
|
||||
{
|
||||
public function getVersion()
|
||||
{
|
||||
return '2.4';
|
||||
|
||||
@@ -6,8 +6,8 @@ class ServerVersionNext extends ServerVersion24
|
||||
{
|
||||
public function getVersion()
|
||||
{
|
||||
return '2.6';
|
||||
}
|
||||
return '2.6';
|
||||
}
|
||||
|
||||
public function getSupportedCommands()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user