| @@ 185-196 (lines=12) @@ | ||
| 182 | * @return \Closure |
|
| 183 | * @throws \InvalidArgumentException |
|
| 184 | */ |
|
| 185 | public function reducing($name) |
|
| 186 | { |
|
| 187 | // note, once we stop supporting php 5.5, we can rewrite the code below |
|
| 188 | // to the reducing($name, ...$args) structure. |
|
| 189 | // http://php.net/manual/en/functions.arguments.php#functions.variable-arg-list |
|
| 190 | ||
| 191 | if (is_string($name) && in_array($name, [ |
|
| 192 | 'add', |
|
| 193 | 'chain', |
|
| 194 | 'join', |
|
| 195 | 'max', |
|
| 196 | 'min', |
|
| 197 | 'mul', |
|
| 198 | 'sub', |
|
| 199 | ])) { |
|
| @@ 252-263 (lines=12) @@ | ||
| 249 | * @return \Closure |
|
| 250 | * @throws \InvalidArgumentException |
|
| 251 | */ |
|
| 252 | public function filtering($name) |
|
| 253 | { |
|
| 254 | // note, once we stop supporting php 5.5, we can rewrite the code below |
|
| 255 | // to the reducing($name, ...$args) structure. |
|
| 256 | // http://php.net/manual/en/functions.arguments.php#functions.variable-arg-list |
|
| 257 | ||
| 258 | if (is_string($name) && in_array($name, [ |
|
| 259 | 'equals', |
|
| 260 | 'in', |
|
| 261 | 'match', |
|
| 262 | 'not', |
|
| 263 | 'not_in', |
|
| 264 | 'type', |
|
| 265 | ])) { |
|
| 266 | return call_user_func_array(sprintf('\Zicht\Itertools\filters\%s', $name), array_slice(func_get_args(), 1)); |
|