@@ -3,11 +3,11 @@ |
||
3 | 3 | |
4 | 4 | use Baethon\Phln\Phln as P; |
5 | 5 | |
6 | -P::macro('path', function (string $path, $object) { |
|
6 | +P::macro('path', function(string $path, $object) { |
|
7 | 7 | $keys = P::split('.', $path); |
8 | 8 | |
9 | 9 | return P::reduce( |
10 | - function ($carry, $key) { |
|
10 | + function($carry, $key) { |
|
11 | 11 | if (false === is_array($carry) && false === is_object($carry)) { |
12 | 12 | return null; |
13 | 13 | } |
@@ -3,6 +3,6 @@ |
||
3 | 3 | |
4 | 4 | use Baethon\Phln\Phln as P; |
5 | 5 | |
6 | -P::macro('pathOr', function (string $path, $default, array $object) { |
|
6 | +P::macro('pathOr', function(string $path, $default, array $object) { |
|
7 | 7 | return P::path($path, $object) ?? $default; |
8 | 8 | }); |
@@ -3,7 +3,7 @@ |
||
3 | 3 | |
4 | 4 | use Baethon\Phln\Phln as P; |
5 | 5 | |
6 | -P::macro('eqProps', function (string $prop, $left, $right): bool { |
|
6 | +P::macro('eqProps', function(string $prop, $left, $right): bool { |
|
7 | 7 | return P::apply( |
8 | 8 | P::pipe([ |
9 | 9 | P::map(P::prop($prop)), |
@@ -3,6 +3,6 @@ |
||
3 | 3 | |
4 | 4 | use Baethon\Phln\Phln as P; |
5 | 5 | |
6 | -P::macro('pluck', function ($key, array $list): array { |
|
6 | +P::macro('pluck', function($key, array $list): array { |
|
7 | 7 | return P::map(P::prop($key), $list); |
8 | 8 | }); |
@@ -3,6 +3,6 @@ |
||
3 | 3 | |
4 | 4 | use Baethon\Phln\Phln as P; |
5 | 5 | |
6 | -P::macro('reduce', function (callable $reducer, $initialValue, array $list) { |
|
6 | +P::macro('reduce', function(callable $reducer, $initialValue, array $list) { |
|
7 | 7 | return array_reduce($list, $reducer, $initialValue); |
8 | 8 | }); |
@@ -3,7 +3,7 @@ |
||
3 | 3 | |
4 | 4 | use Baethon\Phln\Phln as P; |
5 | 5 | |
6 | -P::macro('sort', function (callable $comparator, array $list): array { |
|
6 | +P::macro('sort', function(callable $comparator, array $list): array { |
|
7 | 7 | usort($list, $comparator); |
8 | 8 | return $list; |
9 | 9 | }); |
@@ -3,8 +3,8 @@ |
||
3 | 3 | |
4 | 4 | use Baethon\Phln\Phln as P; |
5 | 5 | |
6 | -P::macro('prepend', function ($value, $collection) { |
|
7 | - $arrayPrepend = function (array $copy) use ($value) { |
|
6 | +P::macro('prepend', function($value, $collection) { |
|
7 | + $arrayPrepend = function(array $copy) use ($value) { |
|
8 | 8 | array_unshift($copy, $value); |
9 | 9 | return $copy; |
10 | 10 | }; |
@@ -3,7 +3,7 @@ |
||
3 | 3 | |
4 | 4 | use Baethon\Phln\Phln as P; |
5 | 5 | |
6 | -P::macro('all', function (callable $predicate, array $list): bool { |
|
6 | +P::macro('all', function(callable $predicate, array $list): bool { |
|
7 | 7 | foreach ($list as $value) { |
8 | 8 | if (false === $predicate($value)) { |
9 | 9 | return false; |
@@ -3,6 +3,6 @@ |
||
3 | 3 | |
4 | 4 | use Baethon\Phln\Phln as P; |
5 | 5 | |
6 | -P::macro('map', function (callable $fn = null, array $list = []) { |
|
6 | +P::macro('map', function(callable $fn = null, array $list = []) { |
|
7 | 7 | return array_map($fn, $list); |
8 | 8 | }); |