src/macros/collection/all.php 1 location
|
@@ 7-15 (lines=9) @@
|
4 |
|
|
5 |
|
use Baethon\Phln\Phln as P; |
6 |
|
|
7 |
|
P::macro('all', function (callable $predicate, array $list): bool { |
8 |
|
foreach ($list as $value) { |
9 |
|
if (false === $predicate($value)) { |
10 |
|
return false; |
11 |
|
} |
12 |
|
} |
13 |
|
|
14 |
|
return true; |
15 |
|
}); |
16 |
|
|
src/macros/collection/any.php 1 location
|
@@ 7-15 (lines=9) @@
|
4 |
|
|
5 |
|
use Baethon\Phln\Phln as P; |
6 |
|
|
7 |
|
P::macro('any', function (callable $predicate, array $list): bool { |
8 |
|
foreach ($list as $value) { |
9 |
|
if (true === $predicate($value)) { |
10 |
|
return true; |
11 |
|
} |
12 |
|
} |
13 |
|
|
14 |
|
return false; |
15 |
|
}); |
16 |
|
|