Ver código fonte

Actually implement preprocessor removal from a preprocessor chain.

Daniele Alessandri 14 anos atrás
pai
commit
ae96b0f39f

+ 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) {