| @@ 1684-1697 (lines=14) @@ | ||
| 1681 | * |
|
| 1682 | * @return bool |
|
| 1683 | */ |
|
| 1684 | public function matches(\Closure $closure) |
|
| 1685 | { |
|
| 1686 | // Reduce the array to only booleans |
|
| 1687 | $array = $this->each($closure); |
|
| 1688 | ||
| 1689 | // Check the results |
|
| 1690 | if (count($array) === 0) { |
|
| 1691 | return true; |
|
| 1692 | } |
|
| 1693 | ||
| 1694 | $array = array_search(false, $array->toArray(), false); |
|
| 1695 | ||
| 1696 | return is_bool($array); |
|
| 1697 | } |
|
| 1698 | ||
| 1699 | /** |
|
| 1700 | * Check if any item in the current array matches a truth test. |
|
| @@ 1706-1719 (lines=14) @@ | ||
| 1703 | * |
|
| 1704 | * @return bool |
|
| 1705 | */ |
|
| 1706 | public function matchesAny(\Closure $closure) |
|
| 1707 | { |
|
| 1708 | // Reduce the array to only booleans |
|
| 1709 | $array = $this->each($closure); |
|
| 1710 | ||
| 1711 | // Check the results |
|
| 1712 | if (count($array) === 0) { |
|
| 1713 | return true; |
|
| 1714 | } |
|
| 1715 | ||
| 1716 | $array = array_search(true, $array->toArray(), false); |
|
| 1717 | ||
| 1718 | return is_int($array); |
|
| 1719 | } |
|
| 1720 | ||
| 1721 | /** |
|
| 1722 | * Get the max value from an array. |
|