| @@ 2596-2611 (lines=16) @@ | ||
| 2593 | * |
|
| 2594 | * @return bool |
|
| 2595 | */ |
|
| 2596 | public function matches(\Closure $closure): bool |
|
| 2597 | { |
|
| 2598 | if (\count($this->array, COUNT_NORMAL) === 0) { |
|
| 2599 | return false; |
|
| 2600 | } |
|
| 2601 | ||
| 2602 | foreach ($this->getGenerator() as $key => $value) { |
|
| 2603 | $value = $closure($value, $key); |
|
| 2604 | ||
| 2605 | if ($value === false) { |
|
| 2606 | return false; |
|
| 2607 | } |
|
| 2608 | } |
|
| 2609 | ||
| 2610 | return true; |
|
| 2611 | } |
|
| 2612 | ||
| 2613 | /** |
|
| 2614 | * Check if any item in the current array matches a truth test. |
|
| @@ 2620-2635 (lines=16) @@ | ||
| 2617 | * |
|
| 2618 | * @return bool |
|
| 2619 | */ |
|
| 2620 | public function matchesAny(\Closure $closure): bool |
|
| 2621 | { |
|
| 2622 | if (\count($this->array, COUNT_NORMAL) === 0) { |
|
| 2623 | return false; |
|
| 2624 | } |
|
| 2625 | ||
| 2626 | foreach ($this->getGenerator() as $key => $value) { |
|
| 2627 | $value = $closure($value, $key); |
|
| 2628 | ||
| 2629 | if ($value === true) { |
|
| 2630 | return true; |
|
| 2631 | } |
|
| 2632 | } |
|
| 2633 | ||
| 2634 | return false; |
|
| 2635 | } |
|
| 2636 | ||
| 2637 | /** |
|
| 2638 | * Get the max value from an array. |
|