Browse Source

Rename Predis\Connection to Predis\ConnectionFactory and disallow the creation of instances for this class.

Daniele Alessandri 15 years ago
parent
commit
68397fe958
1 changed files with 6 additions and 2 deletions
  1. 6 2
      lib/Predis.php

+ 6 - 2
lib/Predis.php

@@ -117,7 +117,7 @@ class Client {
         $params     = $parameters instanceof ConnectionParameters 
                           ? $parameters 
                           : new ConnectionParameters($parameters);
-        $connection = Connection::create($params, $this->_responseReader);
+        $connection = ConnectionFactory::create($params, $this->_responseReader);
 
         if ($params->password !== null) {
             $connection->pushInitCommand($this->createCommand(
@@ -1218,9 +1218,13 @@ interface IConnectionCluster extends IConnection {
     public function getConnectionById($connectionId);
 }
 
-class Connection {
+final class ConnectionFactory {
     private static $_registeredSchemes;
 
+    private function __construct() {
+        // NOOP
+    }
+
     private static function ensureInitialized() {
         if (!isset(self::$_registeredSchemes)) {
             self::$_registeredSchemes = self::getDefaultSchemes();