@@ -4,7 +4,7 @@ |
||
4 | 4 | use Baethon\Phln\Phln as P; |
5 | 5 | use Baethon\Phln\RegExp; |
6 | 6 | |
7 | -P::macro('split', function ($delimiter, string $text): array { |
|
7 | +P::macro('split', function($delimiter, string $text): array { |
|
8 | 8 | $result = preg_split((string) RegExp::of($delimiter), $text); |
9 | 9 | $error = preg_last_error(); |
10 | 10 |
@@ -3,8 +3,8 @@ discard block |
||
3 | 3 | |
4 | 4 | use Baethon\Phln\Phln as P; |
5 | 5 | |
6 | -P::macro('partial', call_user_func(function () { |
|
7 | - $mergeArguments = function (array $args, array $innerArgs) { |
|
6 | +P::macro('partial', call_user_func(function() { |
|
7 | + $mergeArguments = function(array $args, array $innerArgs) { |
|
8 | 8 | $mapped = []; |
9 | 9 | |
10 | 10 | foreach ($args as $value) { |
@@ -18,8 +18,8 @@ discard block |
||
18 | 18 | return array_merge($mapped, $innerArgs); |
19 | 19 | }; |
20 | 20 | |
21 | - return function (callable $fn, array $args) use ($mergeArguments): callable { |
|
22 | - return function (...$innerArgs) use ($fn, $args, $mergeArguments) { |
|
21 | + return function(callable $fn, array $args) use ($mergeArguments): callable { |
|
22 | + return function(...$innerArgs) use ($fn, $args, $mergeArguments) { |
|
23 | 23 | return $fn(...$mergeArguments($args, $innerArgs)); |
24 | 24 | }; |
25 | 25 | }; |
@@ -3,8 +3,8 @@ |
||
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 = ['cached' => false, 'value' => null]; |
9 | 9 | |
10 | 10 | if (false === $result['cached']) { |
@@ -6,9 +6,9 @@ |
||
6 | 6 | |
7 | 7 | load_macro('type', 'is'); |
8 | 8 | |
9 | -P::macro('typeCond', call_user_func(function () { |
|
9 | +P::macro('typeCond', call_user_func(function() { |
|
10 | 10 | $typeToPredicate = P::ifElse('\\is_callable', P::identity(), P::is()); |
11 | - $mapRow = function ($row) use ($typeToPredicate) { |
|
11 | + $mapRow = function($row) use ($typeToPredicate) { |
|
12 | 12 | $p = $typeToPredicate($row[0]); |
13 | 13 | return [$p, $row[1]]; |
14 | 14 | }; |
@@ -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('pick', function (array $useKeys, $object): array { |
|
7 | +P::macro('pick', function(array $useKeys, $object): array { |
|
8 | 8 | assert_object($object); |
9 | 9 | return array_intersect_key((array) $object, array_combine($useKeys, $useKeys) ?: []); |
10 | 10 | }); |
@@ -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 ($object, $predicates) { |
|
13 | + function($key) use ($object, $predicates) { |
|
14 | 14 | $value = P::prop($key, $object); |
15 | 15 | return $predicates[$key]($value); |
16 | 16 | }, |
@@ -3,14 +3,14 @@ |
||
3 | 3 | |
4 | 4 | use Baethon\Phln\Phln as P; |
5 | 5 | |
6 | -P::macro('unique', call_user_func(function () { |
|
7 | - $reducer = function ($carry, $item) { |
|
6 | +P::macro('unique', call_user_func(function() { |
|
7 | + $reducer = function($carry, $item) { |
|
8 | 8 | return in_array($item, $carry, true) |
9 | 9 | ? $carry |
10 | 10 | : P::append($item, $carry); |
11 | 11 | }; |
12 | 12 | |
13 | - return function (array $list) use ($reducer): array { |
|
13 | + return function(array $list) use ($reducer): array { |
|
14 | 14 | return array_reduce($list, $reducer, []); |
15 | 15 | }; |
16 | 16 | })); |