| @@ 55-66 (lines=12) @@ | ||
| 52 | }; |
|
| 53 | } |
|
| 54 | ||
| 55 | function all(callable ...$functions) |
|
| 56 | { |
|
| 57 | return function (...$args) use ($functions) { |
|
| 58 | foreach ($functions as $function) { |
|
| 59 | if (!$function(...$args)) { |
|
| 60 | return false; |
|
| 61 | } |
|
| 62 | } |
|
| 63 | ||
| 64 | return true; |
|
| 65 | }; |
|
| 66 | } |
|
| 67 | ||
| 68 | function any(callable ...$functions) |
|
| 69 | { |
|
| @@ 68-79 (lines=12) @@ | ||
| 65 | }; |
|
| 66 | } |
|
| 67 | ||
| 68 | function any(callable ...$functions) |
|
| 69 | { |
|
| 70 | return function (...$args) use ($functions) { |
|
| 71 | foreach ($functions as $function) { |
|
| 72 | if ($function(...$args)) { |
|
| 73 | return true; |
|
| 74 | } |
|
| 75 | } |
|
| 76 | ||
| 77 | return false; |
|
| 78 | }; |
|
| 79 | } |
|
| 80 | ||
| 81 | function predicate($predicate) : callable |
|
| 82 | { |
|