| @@ 593-606 (lines=14) @@ | ||
| 590 | * |
|
| 591 | * @return bool |
|
| 592 | */ |
|
| 593 | public function matches(\Closure $closure) |
|
| 594 | { |
|
| 595 | // Reduce the array to only booleans |
|
| 596 | $array = $this->each($closure); |
|
| 597 | ||
| 598 | // Check the results |
|
| 599 | if (count($array) === 0) { |
|
| 600 | return true; |
|
| 601 | } |
|
| 602 | ||
| 603 | $array = array_search(false, $array->toArray(), false); |
|
| 604 | ||
| 605 | return is_bool($array); |
|
| 606 | } |
|
| 607 | ||
| 608 | /** |
|
| 609 | * Iterate over the current array and modify the array's value. |
|
| @@ 653-666 (lines=14) @@ | ||
| 650 | * |
|
| 651 | * @return bool |
|
| 652 | */ |
|
| 653 | public function matchesAny(\Closure $closure) |
|
| 654 | { |
|
| 655 | // Reduce the array to only booleans |
|
| 656 | $array = $this->each($closure); |
|
| 657 | ||
| 658 | // Check the results |
|
| 659 | if (count($array) === 0) { |
|
| 660 | return true; |
|
| 661 | } |
|
| 662 | ||
| 663 | $array = array_search(true, $array->toArray(), false); |
|
| 664 | ||
| 665 | return is_int($array); |
|
| 666 | } |
|
| 667 | ||
| 668 | /** |
|
| 669 | * Returns a new ArrayIterator, thus implementing the IteratorAggregate interface. |
|