Explorar o código

Actually implement preprocessor removal from a preprocessor chain.

Daniele Alessandri %!s(int64=14) %!d(string=hai) anos
pai
achega
ae96b0f39f
Modificáronse 1 ficheiros con 4 adicións e 1 borrados
  1. 4 1
      lib/Predis/Commands/Preprocessors/PreprocessorChain.php

+ 4 - 1
lib/Predis/Commands/Preprocessors/PreprocessorChain.php

@@ -16,7 +16,10 @@ class PreprocessorChain implements ICommandPreprocessorChain, \ArrayAccess {
     }
 
     public function remove(ICommandPreprocessor $preprocessor) {
-        // TODO: find index of value
+        $index = array_search($preprocessor, $this->_preprocessors, true);
+        if ($index !== false) {
+            unset($this->_preprocessors);
+        }
     }
 
     public function process(&$method, &$arguments) {