| @@ 43-54 (lines=12) @@ | ||
| 40 | }; |
|
| 41 | } |
|
| 42 | ||
| 43 | function all(callable ...$functions) |
|
| 44 | { |
|
| 45 | return function (...$args) use ($functions) { |
|
| 46 | foreach ($functions as $function) { |
|
| 47 | if (!$function(...$args)) { |
|
| 48 | return false; |
|
| 49 | } |
|
| 50 | } |
|
| 51 | ||
| 52 | return true; |
|
| 53 | }; |
|
| 54 | } |
|
| 55 | ||
| 56 | function any(callable ...$functions) |
|
| 57 | { |
|
| @@ 56-67 (lines=12) @@ | ||
| 53 | }; |
|
| 54 | } |
|
| 55 | ||
| 56 | function any(callable ...$functions) |
|
| 57 | { |
|
| 58 | return function (...$args) use ($functions) { |
|
| 59 | foreach ($functions as $function) { |
|
| 60 | if ($function(...$args)) { |
|
| 61 | return true; |
|
| 62 | } |
|
| 63 | } |
|
| 64 | ||
| 65 | return false; |
|
| 66 | }; |
|
| 67 | } |
|
| 68 | ||
| 69 | function predicate($predicate) : callable |
|
| 70 | { |
|