@@ -3,12 +3,12 @@ |
||
| 3 | 3 | |
| 4 | 4 | use Baethon\Phln\Phln as P; |
| 5 | 5 | |
| 6 | -P::macro('once', function (callable $fn): \Closure { |
|
| 7 | - return function (... $args) use ($fn) { |
|
| 6 | +P::macro('once', function(callable $fn): \Closure { |
|
| 7 | + return function(... $args) use ($fn) { |
|
| 8 | 8 | static $result; |
| 9 | 9 | |
| 10 | 10 | if (false === is_object($result)) { |
| 11 | - $result = (object)['result' => $fn(... $args)]; |
|
| 11 | + $result = (object) ['result' => $fn(... $args)]; |
|
| 12 | 12 | } |
| 13 | 13 | |
| 14 | 14 | return $result->result; |
@@ -3,6 +3,6 @@ |
||
| 3 | 3 | |
| 4 | 4 | use Baethon\Phln\Phln as P; |
| 5 | 5 | |
| 6 | -P::macro('identity', function ($value) { |
|
| 6 | +P::macro('identity', function($value) { |
|
| 7 | 7 | return $value; |
| 8 | 8 | }); |
@@ -3,7 +3,7 @@ |
||
| 3 | 3 | |
| 4 | 4 | use Baethon\Phln\Phln as P; |
| 5 | 5 | |
| 6 | -P::macro('F', function (): bool { |
|
| 6 | +P::macro('F', function(): bool { |
|
| 7 | 7 | return false; |
| 8 | 8 | }); |
| 9 | 9 | |
@@ -3,7 +3,7 @@ |
||
| 3 | 3 | |
| 4 | 4 | use Baethon\Phln\Phln as P; |
| 5 | 5 | |
| 6 | -P::macro('compose', function (array $fns): \Closure { |
|
| 6 | +P::macro('compose', function(array $fns): \Closure { |
|
| 7 | 7 | if (0 === count($fns)) { |
| 8 | 8 | throw new \UnderflowException('compose requires at least one argument'); |
| 9 | 9 | } |
@@ -3,7 +3,7 @@ |
||
| 3 | 3 | |
| 4 | 4 | use Baethon\Phln\Phln as P; |
| 5 | 5 | |
| 6 | -P::macro('T', function (): bool { |
|
| 6 | +P::macro('T', function(): bool { |
|
| 7 | 7 | return true; |
| 8 | 8 | }); |
| 9 | 9 | |
@@ -3,16 +3,16 @@ |
||
| 3 | 3 | |
| 4 | 4 | use Baethon\Phln\Phln as P; |
| 5 | 5 | |
| 6 | -P::macro('pipe', function (array $fns): \Closure { |
|
| 6 | +P::macro('pipe', function(array $fns): \Closure { |
|
| 7 | 7 | if (0 === count($fns)) { |
| 8 | 8 | throw new \UnderflowException('pipe requires at least one argument'); |
| 9 | 9 | } |
| 10 | 10 | |
| 11 | - return function (...$args) use ($fns) { |
|
| 11 | + return function(...$args) use ($fns) { |
|
| 12 | 12 | $head = $fns[0]; |
| 13 | 13 | $tail = array_slice($fns, 1); |
| 14 | 14 | |
| 15 | - return array_reduce($tail, function ($carry, callable $fn) { |
|
| 15 | + return array_reduce($tail, function($carry, callable $fn) { |
|
| 16 | 16 | return $fn($carry); |
| 17 | 17 | }, $head(... $args)); |
| 18 | 18 | }; |
@@ -4,7 +4,7 @@ |
||
| 4 | 4 | use Baethon\Phln\Phln as P; |
| 5 | 5 | use function Baethon\Phln\assert_object; |
| 6 | 6 | |
| 7 | -P::macro('omit', function (array $omitKeys, $object): array { |
|
| 7 | +P::macro('omit', function(array $omitKeys, $object): array { |
|
| 8 | 8 | assert_object($object); |
| 9 | 9 | |
| 10 | 10 | return array_diff_key((array) $object, array_combine($omitKeys, $omitKeys)); |
@@ -4,13 +4,13 @@ |
||
| 4 | 4 | use Baethon\Phln\Phln as P; |
| 5 | 5 | use function Baethon\Phln\assert_object; |
| 6 | 6 | |
| 7 | -P::macro('where', function (array $predicates, $object): bool { |
|
| 7 | +P::macro('where', function(array $predicates, $object): bool { |
|
| 8 | 8 | assert_object($object); |
| 9 | 9 | |
| 10 | 10 | $keys = P::keys($predicates); |
| 11 | 11 | |
| 12 | 12 | return P::all( |
| 13 | - function ($key) use ($keys, $object, $predicates) { |
|
| 13 | + function($key) use ($keys, $object, $predicates) { |
|
| 14 | 14 | $value = P::prop($key, $object); |
| 15 | 15 | return $predicates[$key]($value); |
| 16 | 16 | }, |
@@ -4,7 +4,7 @@ |
||
| 4 | 4 | use Baethon\Phln\Phln as P; |
| 5 | 5 | use function Baethon\Phln\assert_object; |
| 6 | 6 | |
| 7 | -P::macro('whereEq', function (array $predicates, $object): bool { |
|
| 7 | +P::macro('whereEq', function(array $predicates, $object): bool { |
|
| 8 | 8 | assert_object($object); |
| 9 | 9 | |
| 10 | 10 | return P::where( |