Flatten PFC_NChildren arguments.
authorFlorent Bruneau <florent.bruneau@polytechnique.org>
Sun, 16 May 2010 20:24:26 +0000 (22:24 +0200)
committerFlorent Bruneau <florent.bruneau@polytechnique.org>
Sun, 16 May 2010 20:25:40 +0000 (22:25 +0200)
Signed-off-by: Florent Bruneau <florent.bruneau@polytechnique.org>
classes/plfilter.php

index c478732..09aea0a 100644 (file)
@@ -246,10 +246,14 @@ abstract class PFC_NChildren implements PlFilterCondition
 
     public function __construct()
     {
-        $children = func_get_args();
-        foreach ($children as &$child) {
-            if (!is_null($child) && ($child instanceof PlFilterCondition)) {
-                $this->addChild($child);
+        $this->addChildren(pl_flatten(func_get_args()));
+    }
+
+    public function addChildren(array $conds)
+    {
+        foreach ($conds as &$cond) {
+            if (!is_null($cond) && ($cond instanceof PlFilterCondition)) {
+                $this->addChild($cond);
             }
         }
     }