Selaa lähdekoodia

Added the test ifNotInArray

Christophe Coevoet 14 vuotta sitten
vanhempi
commit
6b4538a1c4

+ 14 - 0
src/Symfony/Component/DependencyInjection/Configuration/Builder/ExprBuilder.php

@@ -114,6 +114,20 @@ class ExprBuilder
         return $this;
     }
 
+    /**
+     * Tests if the value is not in an array.
+     *
+     * @param array $array
+     *
+     * @return Symfony\Component\DependencyInjection\Configuration\Builder\ExprBuilder
+     */
+    public function ifNotInArray(array $array)
+    {
+        $this->ifPart = function($v) use ($array) { return !in_array($v, $array, true); };
+
+        return $this;
+    }
+
     /**
      * Sets the closure to run if the test pass.
      *