| @@ 307-319 (lines=13) @@ | ||
| 304 | * |
|
| 305 | * @return bool |
|
| 306 | */ |
|
| 307 | public function matches(\Closure $closure) |
|
| 308 | { |
|
| 309 | // Reduce the array to only booleans |
|
| 310 | $array = $this->each($closure); |
|
| 311 | ||
| 312 | // Check the results |
|
| 313 | if (count($array) === 0) { |
|
| 314 | return true; |
|
| 315 | } |
|
| 316 | $array = array_search(false, $array, false); |
|
| 317 | ||
| 318 | return is_bool($array); |
|
| 319 | } |
|
| 320 | ||
| 321 | /** |
|
| 322 | * Check if any item in the current array matches a truth test. |
|
| @@ 328-340 (lines=13) @@ | ||
| 325 | * |
|
| 326 | * @return bool |
|
| 327 | */ |
|
| 328 | public function matchesAny(\Closure $closure) |
|
| 329 | { |
|
| 330 | // Reduce the array to only booleans |
|
| 331 | $array = $this->each($closure); |
|
| 332 | ||
| 333 | // Check the results |
|
| 334 | if (count($array) === 0) { |
|
| 335 | return true; |
|
| 336 | } |
|
| 337 | $array = array_search(true, $array, false); |
|
| 338 | ||
| 339 | return is_int($array); |
|
| 340 | } |
|
| 341 | ||
| 342 | /** |
|
| 343 | * Check if we have named keys in the current array. |
|