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