| @@ 1646-1659 (lines=14) @@ | ||
| 1643 | * |
|
| 1644 | * @return bool |
|
| 1645 | */ |
|
| 1646 | public function matches(\Closure $closure) |
|
| 1647 | { |
|
| 1648 | // Reduce the array to only booleans |
|
| 1649 | $array = $this->each($closure); |
|
| 1650 | ||
| 1651 | // Check the results |
|
| 1652 | if (count($array) === 0) { |
|
| 1653 | return true; |
|
| 1654 | } |
|
| 1655 | ||
| 1656 | $array = array_search(false, $array->toArray(), false); |
|
| 1657 | ||
| 1658 | return is_bool($array); |
|
| 1659 | } |
|
| 1660 | ||
| 1661 | /** |
|
| 1662 | * Check if any item in the current array matches a truth test. |
|
| @@ 1668-1681 (lines=14) @@ | ||
| 1665 | * |
|
| 1666 | * @return bool |
|
| 1667 | */ |
|
| 1668 | public function matchesAny(\Closure $closure) |
|
| 1669 | { |
|
| 1670 | // Reduce the array to only booleans |
|
| 1671 | $array = $this->each($closure); |
|
| 1672 | ||
| 1673 | // Check the results |
|
| 1674 | if (count($array) === 0) { |
|
| 1675 | return true; |
|
| 1676 | } |
|
| 1677 | ||
| 1678 | $array = array_search(true, $array->toArray(), false); |
|
| 1679 | ||
| 1680 | return is_int($array); |
|
| 1681 | } |
|
| 1682 | ||
| 1683 | /** |
|
| 1684 | * Get the max value from an array. |
|