| @@ 1596-1609 (lines=14) @@ | ||
| 1593 | * |
|
| 1594 | * @return bool |
|
| 1595 | */ |
|
| 1596 | public function matches(\Closure $closure) |
|
| 1597 | { |
|
| 1598 | // Reduce the array to only booleans |
|
| 1599 | $array = $this->each($closure); |
|
| 1600 | ||
| 1601 | // Check the results |
|
| 1602 | if (count($array) === 0) { |
|
| 1603 | return true; |
|
| 1604 | } |
|
| 1605 | ||
| 1606 | $array = array_search(false, $array->toArray(), false); |
|
| 1607 | ||
| 1608 | return is_bool($array); |
|
| 1609 | } |
|
| 1610 | ||
| 1611 | /** |
|
| 1612 | * Check if any item in the current array matches a truth test. |
|
| @@ 1618-1631 (lines=14) @@ | ||
| 1615 | * |
|
| 1616 | * @return bool |
|
| 1617 | */ |
|
| 1618 | public function matchesAny(\Closure $closure) |
|
| 1619 | { |
|
| 1620 | // Reduce the array to only booleans |
|
| 1621 | $array = $this->each($closure); |
|
| 1622 | ||
| 1623 | // Check the results |
|
| 1624 | if (count($array) === 0) { |
|
| 1625 | return true; |
|
| 1626 | } |
|
| 1627 | ||
| 1628 | $array = array_search(true, $array->toArray(), false); |
|
| 1629 | ||
| 1630 | return is_int($array); |
|
| 1631 | } |
|
| 1632 | ||
| 1633 | /** |
|
| 1634 | * Get the max value from an array. |
|