| @@ 1451-1464 (lines=14) @@ | ||
| 1448 | * |
|
| 1449 | * @return bool |
|
| 1450 | */ |
|
| 1451 | public function matches(\Closure $closure) |
|
| 1452 | { |
|
| 1453 | // Reduce the array to only booleans |
|
| 1454 | $array = $this->each($closure); |
|
| 1455 | ||
| 1456 | // Check the results |
|
| 1457 | if (count($array) === 0) { |
|
| 1458 | return true; |
|
| 1459 | } |
|
| 1460 | ||
| 1461 | $array = array_search(false, $array->toArray(), false); |
|
| 1462 | ||
| 1463 | return is_bool($array); |
|
| 1464 | } |
|
| 1465 | ||
| 1466 | /** |
|
| 1467 | * Check if any item in the current array matches a truth test. |
|
| @@ 1473-1486 (lines=14) @@ | ||
| 1470 | * |
|
| 1471 | * @return bool |
|
| 1472 | */ |
|
| 1473 | public function matchesAny(\Closure $closure) |
|
| 1474 | { |
|
| 1475 | // Reduce the array to only booleans |
|
| 1476 | $array = $this->each($closure); |
|
| 1477 | ||
| 1478 | // Check the results |
|
| 1479 | if (count($array) === 0) { |
|
| 1480 | return true; |
|
| 1481 | } |
|
| 1482 | ||
| 1483 | $array = array_search(true, $array->toArray(), false); |
|
| 1484 | ||
| 1485 | return is_int($array); |
|
| 1486 | } |
|
| 1487 | ||
| 1488 | /** |
|
| 1489 | * Get the max value from an array. |
|