Procházet zdrojové kódy

Change handling of unsupported methods in Predis\Network\WebdisConnection.

Daniele Alessandri před 13 roky
rodič
revize
bc040fae6f
1 změnil soubory, kde provedl 9 přidání a 8 odebrání
  1. 9 8
      lib/Predis/Network/WebdisConnection.php

+ 9 - 8
lib/Predis/Network/WebdisConnection.php

@@ -30,10 +30,6 @@ class WebdisConnection implements IConnectionSingle {
     private $_resource;
     private $_reader;
 
-    private static function throwNotImplementedException($class, $function) {
-        throw new \RuntimeException("The method $class::$function() is not implemented");
-    }
-
     public function __construct(IConnectionParameters $parameters) {
         $this->_parameters = $parameters;
         if ($parameters->scheme !== 'http') {
@@ -49,6 +45,11 @@ class WebdisConnection implements IConnectionSingle {
         phpiredis_reader_destroy($this->_reader);
     }
 
+    private function throwNotSupportedException($function) {
+        $class = __CLASS__;
+        throw new \RuntimeException("The method $class::$function() is not supported");
+    }
+
     private function checkExtensions() {
         if (!function_exists('curl_init')) {
             throw new ClientException(sprintf(ERR_MSG_EXTENSION, 'curl'));
@@ -118,11 +119,11 @@ class WebdisConnection implements IConnectionSingle {
     }
 
     public function writeCommand(ICommand $command) {
-        self::throwNotImplementedException(__CLASS__, __FUNCTION__);
+        $this->throwNotSupportedException(__FUNCTION__);
     }
 
     public function readResponse(ICommand $command) {
-        self::throwNotImplementedException(__CLASS__, __FUNCTION__);
+        $this->throwNotSupportedException(__FUNCTION__);
     }
 
     protected function getCommandId(ICommand $command) {
@@ -182,11 +183,11 @@ class WebdisConnection implements IConnectionSingle {
     }
 
     public function pushInitCommand(ICommand $command) {
-        self::throwNotImplementedException(__CLASS__, __FUNCTION__);
+        $this->throwNotSupportedException(__FUNCTION__);
     }
 
     public function read() {
-        self::throwNotImplementedException(__CLASS__, __FUNCTION__);
+        $this->throwNotSupportedException(__FUNCTION__);
     }
 
     public function __toString() {