| @@ 1509-1522 (lines=14) @@ | ||
| 1506 | * |
|
| 1507 | * @return bool |
|
| 1508 | */ |
|
| 1509 | public function matches(\Closure $closure) |
|
| 1510 | { |
|
| 1511 | // Reduce the array to only booleans |
|
| 1512 | $array = $this->each($closure); |
|
| 1513 | ||
| 1514 | // Check the results |
|
| 1515 | if (count($array) === 0) { |
|
| 1516 | return true; |
|
| 1517 | } |
|
| 1518 | ||
| 1519 | $array = array_search(false, $array->toArray(), false); |
|
| 1520 | ||
| 1521 | return is_bool($array); |
|
| 1522 | } |
|
| 1523 | ||
| 1524 | /** |
|
| 1525 | * Check if any item in the current array matches a truth test. |
|
| @@ 1531-1544 (lines=14) @@ | ||
| 1528 | * |
|
| 1529 | * @return bool |
|
| 1530 | */ |
|
| 1531 | public function matchesAny(\Closure $closure) |
|
| 1532 | { |
|
| 1533 | // Reduce the array to only booleans |
|
| 1534 | $array = $this->each($closure); |
|
| 1535 | ||
| 1536 | // Check the results |
|
| 1537 | if (count($array) === 0) { |
|
| 1538 | return true; |
|
| 1539 | } |
|
| 1540 | ||
| 1541 | $array = array_search(true, $array->toArray(), false); |
|
| 1542 | ||
| 1543 | return is_int($array); |
|
| 1544 | } |
|
| 1545 | ||
| 1546 | /** |
|
| 1547 | * Get the max value from an array. |
|