@@ -3,6 +3,6 @@ |
||
3 | 3 | |
4 | 4 | use Baethon\Phln\Phln as P; |
5 | 5 | |
6 | -P::macro('gt', function ($a, $b): bool { |
|
6 | +P::macro('gt', function($a, $b): bool { |
|
7 | 7 | return $a > $b; |
8 | 8 | }); |
@@ -3,6 +3,6 @@ |
||
3 | 3 | |
4 | 4 | use Baethon\Phln\Phln as P; |
5 | 5 | |
6 | -P::macro('lt', function ($left, $right): bool { |
|
6 | +P::macro('lt', function($left, $right): bool { |
|
7 | 7 | return $left < $right; |
8 | 8 | }); |
@@ -3,16 +3,16 @@ |
||
3 | 3 | |
4 | 4 | use Baethon\Phln\Phln as P; |
5 | 5 | |
6 | -P::macro('allPass', call_user_func(function () { |
|
6 | +P::macro('allPass', call_user_func(function() { |
|
7 | 7 | $getArity = P::pipe([ |
8 | 8 | P::map(P::ref('arity')), |
9 | 9 | P::reduce(P::ref('max'), 0), |
10 | 10 | ]); |
11 | 11 | |
12 | - return function (array $predicates) use ($getArity): callable { |
|
13 | - return P::curryN($getArity($predicates), function (...$values) use ($predicates) { |
|
12 | + return function(array $predicates) use ($getArity): callable { |
|
13 | + return P::curryN($getArity($predicates), function(...$values) use ($predicates) { |
|
14 | 14 | return P::reduce( |
15 | - function ($carry, callable $p) use ($values) { |
|
15 | + function($carry, callable $p) use ($values) { |
|
16 | 16 | return (false === $carry) ? false : $p(...$values); |
17 | 17 | }, |
18 | 18 | true, |
@@ -3,8 +3,8 @@ |
||
3 | 3 | |
4 | 4 | use Baethon\Phln\Phln as P; |
5 | 5 | |
6 | -P::macro('cond', function (array $pairs): \Closure { |
|
7 | - return function (... $args) use ($pairs) { |
|
6 | +P::macro('cond', function(array $pairs): \Closure { |
|
7 | + return function(... $args) use ($pairs) { |
|
8 | 8 | $callPredicate = P::partialRight(P::ref('apply'), [$args]); |
9 | 9 | $pairMatchingArgs = P::compose([$callPredicate, P::nth(0)]); |
10 | 10 | $getTransformer = P::pipe([ |
@@ -3,7 +3,7 @@ |
||
3 | 3 | |
4 | 4 | use Baethon\Phln\Phln as P; |
5 | 5 | |
6 | -P::macro('isEmpty', function ($value): bool { |
|
6 | +P::macro('isEmpty', function($value): bool { |
|
7 | 7 | switch (gettype($value)) { |
8 | 8 | case 'array': |
9 | 9 | return [] === $value; |
@@ -3,6 +3,6 @@ |
||
3 | 3 | |
4 | 4 | use Baethon\Phln\Phln as P; |
5 | 5 | |
6 | -P::macro('not', function ($value): bool { |
|
6 | +P::macro('not', function($value): bool { |
|
7 | 7 | return !$value; |
8 | 8 | }); |
@@ -6,16 +6,16 @@ discard block |
||
6 | 6 | |
7 | 7 | load_macro('type', 'is'); |
8 | 8 | |
9 | -P::macro('either', call_user_func(function () { |
|
9 | +P::macro('either', call_user_func(function() { |
|
10 | 10 | $allPrimitives = P::unapply(P::all(P::is('bool'))); |
11 | 11 | $allCallables = P::unapply(P::all(P::is('callable'))); |
12 | 12 | |
13 | - $compareBooleans = function ($left, $right) { |
|
13 | + $compareBooleans = function($left, $right) { |
|
14 | 14 | return $left || $right; |
15 | 15 | }; |
16 | 16 | |
17 | - $eitherPredicate = function ($left, $right) { |
|
18 | - return function (...$args) use ($left, $right) { |
|
17 | + $eitherPredicate = function($left, $right) { |
|
18 | + return function(...$args) use ($left, $right) { |
|
19 | 19 | return $left(...$args) || $right(...$args); |
20 | 20 | }; |
21 | 21 | }; |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | [P::ref('otherwise'), P::throwException(\InvalidArgumentException::class, [])], |
27 | 27 | ]); |
28 | 28 | |
29 | - return function ($left, $right) use ($either) { |
|
29 | + return function($left, $right) use ($either) { |
|
30 | 30 | return $either($left, $right); |
31 | 31 | }; |
32 | 32 | })); |
@@ -3,6 +3,6 @@ |
||
3 | 3 | |
4 | 4 | use Baethon\Phln\Phln as P; |
5 | 5 | |
6 | -P::macro('defaultTo', function ($default, $value) { |
|
6 | +P::macro('defaultTo', function($default, $value) { |
|
7 | 7 | return is_null($value) ? $default : $value; |
8 | 8 | }); |
@@ -3,8 +3,8 @@ |
||
3 | 3 | |
4 | 4 | use Baethon\Phln\Phln as P; |
5 | 5 | |
6 | -P::macro('ifElse', function (callable $predicate, callable $onTrue, callable $onFalse): \Closure { |
|
7 | - return function (...$args) use ($predicate, $onTrue, $onFalse) { |
|
6 | +P::macro('ifElse', function(callable $predicate, callable $onTrue, callable $onFalse): \Closure { |
|
7 | + return function(...$args) use ($predicate, $onTrue, $onFalse) { |
|
8 | 8 | return $predicate(...$args) |
9 | 9 | ? $onTrue(...$args) |
10 | 10 | : $onFalse(...$args); |