소스 검색

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