浏览代码

Added the test ifNotInArray

Christophe Coevoet 14 年之前
父节点
当前提交
6b4538a1c4
共有 1 个文件被更改,包括 14 次插入0 次删除
  1. 14 0
      src/Symfony/Component/DependencyInjection/Configuration/Builder/ExprBuilder.php

+ 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.
      *