| @@ 321-333 (lines=13) @@ | ||
| 318 | * |
|
| 319 | * @return bool |
|
| 320 | */ |
|
| 321 | public function matches(\Closure $closure) |
|
| 322 | { |
|
| 323 | // Reduce the array to only booleans |
|
| 324 | $array = $this->each($closure); |
|
| 325 | ||
| 326 | // Check the results |
|
| 327 | if (count($array) === 0) { |
|
| 328 | return true; |
|
| 329 | } |
|
| 330 | $array = array_search(false, $array, false); |
|
| 331 | ||
| 332 | return is_bool($array); |
|
| 333 | } |
|
| 334 | ||
| 335 | /** |
|
| 336 | * Check if any item in the current array matches a truth test. |
|
| @@ 342-354 (lines=13) @@ | ||
| 339 | * |
|
| 340 | * @return bool |
|
| 341 | */ |
|
| 342 | public function matchesAny(\Closure $closure) |
|
| 343 | { |
|
| 344 | // Reduce the array to only booleans |
|
| 345 | $array = $this->each($closure); |
|
| 346 | ||
| 347 | // Check the results |
|
| 348 | if (count($array) === 0) { |
|
| 349 | return true; |
|
| 350 | } |
|
| 351 | $array = array_search(true, $array, false); |
|
| 352 | ||
| 353 | return is_int($array); |
|
| 354 | } |
|
| 355 | ||
| 356 | /** |
|
| 357 | * Check if we have named keys in the current array. |
|