| @@ 2687-2702 (lines=16) @@ | ||
| 2684 | * |
|
| 2685 | * @return bool |
|
| 2686 | */ |
|
| 2687 | public function matches(\Closure $closure): bool |
|
| 2688 | { |
|
| 2689 | if (\count($this->array, \COUNT_NORMAL) === 0) { |
|
| 2690 | return false; |
|
| 2691 | } |
|
| 2692 | ||
| 2693 | foreach ($this->getGenerator() as $key => $value) { |
|
| 2694 | $value = $closure($value, $key); |
|
| 2695 | ||
| 2696 | if ($value === false) { |
|
| 2697 | return false; |
|
| 2698 | } |
|
| 2699 | } |
|
| 2700 | ||
| 2701 | return true; |
|
| 2702 | } |
|
| 2703 | ||
| 2704 | /** |
|
| 2705 | * Check if any item in the current array matches a truth test. |
|
| @@ 2711-2726 (lines=16) @@ | ||
| 2708 | * |
|
| 2709 | * @return bool |
|
| 2710 | */ |
|
| 2711 | public function matchesAny(\Closure $closure): bool |
|
| 2712 | { |
|
| 2713 | if (\count($this->array, \COUNT_NORMAL) === 0) { |
|
| 2714 | return false; |
|
| 2715 | } |
|
| 2716 | ||
| 2717 | foreach ($this->getGenerator() as $key => $value) { |
|
| 2718 | $value = $closure($value, $key); |
|
| 2719 | ||
| 2720 | if ($value === true) { |
|
| 2721 | return true; |
|
| 2722 | } |
|
| 2723 | } |
|
| 2724 | ||
| 2725 | return false; |
|
| 2726 | } |
|
| 2727 | ||
| 2728 | /** |
|
| 2729 | * Get the max value from an array. |
|