| @@ 2528-2543 (lines=16) @@ | ||
| 2525 | * |
|
| 2526 | * @return bool |
|
| 2527 | */ |
|
| 2528 | public function matches(\Closure $closure): bool |
|
| 2529 | { |
|
| 2530 | if (\count($this->array, COUNT_NORMAL) === 0) { |
|
| 2531 | return false; |
|
| 2532 | } |
|
| 2533 | ||
| 2534 | foreach ($this->getGenerator() as $key => $value) { |
|
| 2535 | $value = $closure($value, $key); |
|
| 2536 | ||
| 2537 | if ($value === false) { |
|
| 2538 | return false; |
|
| 2539 | } |
|
| 2540 | } |
|
| 2541 | ||
| 2542 | return true; |
|
| 2543 | } |
|
| 2544 | ||
| 2545 | /** |
|
| 2546 | * Check if any item in the current array matches a truth test. |
|
| @@ 2552-2567 (lines=16) @@ | ||
| 2549 | * |
|
| 2550 | * @return bool |
|
| 2551 | */ |
|
| 2552 | public function matchesAny(\Closure $closure): bool |
|
| 2553 | { |
|
| 2554 | if (\count($this->array, COUNT_NORMAL) === 0) { |
|
| 2555 | return false; |
|
| 2556 | } |
|
| 2557 | ||
| 2558 | foreach ($this->getGenerator() as $key => $value) { |
|
| 2559 | $value = $closure($value, $key); |
|
| 2560 | ||
| 2561 | if ($value === true) { |
|
| 2562 | return true; |
|
| 2563 | } |
|
| 2564 | } |
|
| 2565 | ||
| 2566 | return false; |
|
| 2567 | } |
|
| 2568 | ||
| 2569 | /** |
|
| 2570 | * Get the max value from an array. |
|