@@ -59,8 +59,9 @@ discard block |
||
59 | 59 | $addArgument = function($currentBoundArgs, $arg) use($fnArgsCount) { |
60 | 60 | $currentBoundArgsCount = count($currentBoundArgs); |
61 | 61 | $placeholderPosition = 0; |
62 | - while($placeholderPosition < $currentBoundArgsCount && !_is_placeholder($currentBoundArgs[$placeholderPosition])) |
|
63 | - $placeholderPosition ++; |
|
62 | + while($placeholderPosition < $currentBoundArgsCount && !_is_placeholder($currentBoundArgs[$placeholderPosition])) { |
|
63 | + $placeholderPosition ++; |
|
64 | + } |
|
64 | 65 | if ($currentBoundArgsCount < $fnArgsCount || $placeholderPosition == $currentBoundArgsCount) { |
65 | 66 | $currentBoundArgs[] = $arg; |
66 | 67 | } else { // There is a placeholder and number of bound args >= $fnArgsCount |
@@ -87,8 +88,9 @@ discard block |
||
87 | 88 | $boundArgs = _merge_args($argsCount, $boundArgs, func_get_args()); |
88 | 89 | $numberOfPlaceholders = count(array_filter($boundArgs, _f('_is_placeholder'))); |
89 | 90 | $numberOfGivenArgs = count($boundArgs) - $numberOfPlaceholders; |
90 | - if ($numberOfGivenArgs >= $argsCount) |
|
91 | - return call_user_func_array($fn, $boundArgs); |
|
91 | + if ($numberOfGivenArgs >= $argsCount) { |
|
92 | + return call_user_func_array($fn, $boundArgs); |
|
93 | + } |
|
92 | 94 | return _curried_function($fn, $argsCount, $boundArgs); |
93 | 95 | }; |
94 | 96 | } |
@@ -179,8 +181,9 @@ discard block |
||
179 | 181 | */ |
180 | 182 | function pipe() { |
181 | 183 | $fns = func_get_args(); |
182 | - if(count($fns) < 1) |
|
183 | - return _f('identity'); |
|
184 | + if(count($fns) < 1) { |
|
185 | + return _f('identity'); |
|
186 | + } |
|
184 | 187 | return curry(function () use ($fns) { |
185 | 188 | $result = _apply(array_shift($fns), func_get_args()); |
186 | 189 | foreach ($fns as $fn) { |
@@ -29,9 +29,15 @@ discard block |
||
29 | 29 | */ |
30 | 30 | function type() { |
31 | 31 | $type = function($data) { |
32 | - if ($data instanceof Error) return 'Error'; |
|
33 | - if ($data instanceof Stream) return "Stream({$data->type})"; |
|
34 | - if (is_callable($data)) return 'Function'; |
|
32 | + if ($data instanceof Error) { |
|
33 | + return 'Error'; |
|
34 | + } |
|
35 | + if ($data instanceof Stream) { |
|
36 | + return "Stream({$data->type})"; |
|
37 | + } |
|
38 | + if (is_callable($data)) { |
|
39 | + return 'Function'; |
|
40 | + } |
|
35 | 41 | switch (gettype($data)) { |
36 | 42 | case 'boolean': |
37 | 43 | return 'Boolean'; |
@@ -45,8 +51,9 @@ discard block |
||
45 | 51 | case 'resource': |
46 | 52 | return 'Resource'; |
47 | 53 | case 'array': |
48 | - if (allSatisfies('is_numeric', keys($data))) |
|
49 | - return 'List'; |
|
54 | + if (allSatisfies('is_numeric', keys($data))) { |
|
55 | + return 'List'; |
|
56 | + } |
|
50 | 57 | return 'Array'; |
51 | 58 | case 'object': |
52 | 59 | return 'Object'; |