| @@ 2572-2587 (lines=16) @@ | ||
| 2569 | * |
|
| 2570 | * @return bool |
|
| 2571 | */ |
|
| 2572 | public function matches(\Closure $closure): bool |
|
| 2573 | { |
|
| 2574 | if (\count($this->array, COUNT_NORMAL) === 0) { |
|
| 2575 | return false; |
|
| 2576 | } |
|
| 2577 | ||
| 2578 | foreach ($this->getGenerator() as $key => $value) { |
|
| 2579 | $value = $closure($value, $key); |
|
| 2580 | ||
| 2581 | if ($value === false) { |
|
| 2582 | return false; |
|
| 2583 | } |
|
| 2584 | } |
|
| 2585 | ||
| 2586 | return true; |
|
| 2587 | } |
|
| 2588 | ||
| 2589 | /** |
|
| 2590 | * Check if any item in the current array matches a truth test. |
|
| @@ 2596-2611 (lines=16) @@ | ||
| 2593 | * |
|
| 2594 | * @return bool |
|
| 2595 | */ |
|
| 2596 | public function matchesAny(\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 === true) { |
|
| 2606 | return true; |
|
| 2607 | } |
|
| 2608 | } |
|
| 2609 | ||
| 2610 | return false; |
|
| 2611 | } |
|
| 2612 | ||
| 2613 | /** |
|
| 2614 | * Get the max value from an array. |
|