@@ -142,47 +142,47 @@ |
||
| 142 | 142 | { |
| 143 | 143 | $res = array(); |
| 144 | 144 | $count = count($this->children); |
| 145 | - for($i = 0; $i < $count; $i++) |
|
| 146 | - { |
|
| 145 | + for($i = 0; $i < $count; $i++) |
|
| 146 | + { |
|
| 147 | 147 | if($this->children[$i] === 'and' || $this->children[$i] === 'or') |
| 148 | - { |
|
| 148 | + { |
|
| 149 | 149 | array_push($res, $this->children[$i]); |
| 150 | - } |
|
| 151 | - else |
|
| 152 | - { |
|
| 150 | + } |
|
| 151 | + else |
|
| 152 | + { |
|
| 153 | 153 | $tmp = $this->children[$i]->php_compare($element); |
| 154 | - array_push($res, $tmp); |
|
| 155 | - } |
|
| 156 | - } |
|
| 157 | - if($count === 1) |
|
| 158 | - { |
|
| 154 | + array_push($res, $tmp); |
|
| 155 | + } |
|
| 156 | + } |
|
| 157 | + if($count === 1) |
|
| 158 | + { |
|
| 159 | 159 | return $res[0]; |
| 160 | - } |
|
| 161 | - while($count >= 3) |
|
| 162 | - { |
|
| 163 | - if($res[1] === 'and') |
|
| 160 | + } |
|
| 161 | + while($count >= 3) |
|
| 162 | + { |
|
| 163 | + if($res[1] === 'and') |
|
| 164 | 164 | { |
| 165 | 165 | $var1 = array_shift($res); |
| 166 | 166 | array_shift($res); |
| 167 | 167 | $var2 = array_shift($res); |
| 168 | - $res = array_merge(array($var1 && $var2), $res); |
|
| 168 | + $res = array_merge(array($var1 && $var2), $res); |
|
| 169 | 169 | } |
| 170 | - else if($res[1] === 'or') |
|
| 170 | + else if($res[1] === 'or') |
|
| 171 | 171 | { |
| 172 | 172 | $var1 = array_shift($res); |
| 173 | 173 | array_shift($res); |
| 174 | 174 | $var2 = array_shift($res); |
| 175 | 175 | $res = array_merge(array($var1 || $var2), $res); |
| 176 | - } |
|
| 177 | - $count = count($res); |
|
| 178 | - } |
|
| 176 | + } |
|
| 177 | + $count = count($res); |
|
| 178 | + } |
|
| 179 | 179 | return $res[0]; |
| 180 | 180 | } |
| 181 | 181 | |
| 182 | 182 | public function filter_array(&$array) |
| 183 | 183 | { |
| 184 | 184 | if(is_array($array)) |
| 185 | - { |
|
| 185 | + { |
|
| 186 | 186 | $res = array_filter($array, array($this, 'filterElement')); |
| 187 | 187 | return array_values($res); |
| 188 | 188 | } |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | for($i = 0; $i < $count; $i++) |
| 146 | 146 | { |
| 147 | 147 | if($this->children[$i] === 'and' || $this->children[$i] === 'or') |
| 148 | - { |
|
| 148 | + { |
|
| 149 | 149 | array_push($res, $this->children[$i]); |
| 150 | 150 | } |
| 151 | 151 | else |
@@ -161,14 +161,14 @@ discard block |
||
| 161 | 161 | while($count >= 3) |
| 162 | 162 | { |
| 163 | 163 | if($res[1] === 'and') |
| 164 | - { |
|
| 164 | + { |
|
| 165 | 165 | $var1 = array_shift($res); |
| 166 | 166 | array_shift($res); |
| 167 | 167 | $var2 = array_shift($res); |
| 168 | 168 | $res = array_merge(array($var1 && $var2), $res); |
| 169 | 169 | } |
| 170 | - else if($res[1] === 'or') |
|
| 171 | - { |
|
| 170 | + else if($res[1] === 'or') |
|
| 171 | + { |
|
| 172 | 172 | $var1 = array_shift($res); |
| 173 | 173 | array_shift($res); |
| 174 | 174 | $var2 = array_shift($res); |
@@ -182,7 +182,7 @@ discard block |
||
| 182 | 182 | public function filter_array(&$array) |
| 183 | 183 | { |
| 184 | 184 | if(is_array($array)) |
| 185 | - { |
|
| 185 | + { |
|
| 186 | 186 | $res = array_filter($array, array($this, 'filterElement')); |
| 187 | 187 | return array_values($res); |
| 188 | 188 | } |