@@ -112,8 +112,9 @@ discard block |
||
| 112 | 112 | */ |
| 113 | 113 | function pipe() { |
| 114 | 114 | $fns = func_get_args(); |
| 115 | - if(count($fns) < 1) |
|
| 116 | - return identity(); |
|
| 115 | + if(count($fns) < 1) { |
|
| 116 | + return identity(); |
|
| 117 | + } |
|
| 117 | 118 | return function () use ($fns) { |
| 118 | 119 | $result = _apply(array_shift($fns), func_get_args()); |
| 119 | 120 | foreach ($fns as $fn) { |
@@ -143,8 +144,9 @@ discard block |
||
| 143 | 144 | */ |
| 144 | 145 | function compose() { |
| 145 | 146 | $fns = array_reverse(func_get_args()); |
| 146 | - if(count($fns) < 1) |
|
| 147 | - return identity(); |
|
| 147 | + if(count($fns) < 1) { |
|
| 148 | + return identity(); |
|
| 149 | + } |
|
| 148 | 150 | return function () use ($fns) { |
| 149 | 151 | $result = _apply(array_shift($fns), func_get_args()); |
| 150 | 152 | foreach ($fns as $fn) { |
@@ -222,8 +224,9 @@ discard block |
||
| 222 | 224 | $predicates = func_get_args(); |
| 223 | 225 | return _curry_one(function($value) use(&$predicates) { |
| 224 | 226 | foreach ($predicates as $predicate) { |
| 225 | - if (! $predicate($value)) |
|
| 226 | - return false; |
|
| 227 | + if (! $predicate($value)) { |
|
| 228 | + return false; |
|
| 229 | + } |
|
| 227 | 230 | } |
| 228 | 231 | return true; |
| 229 | 232 | }); |
@@ -256,8 +259,9 @@ discard block |
||
| 256 | 259 | $predicates = func_get_args(); |
| 257 | 260 | return _curry_one(function($value) use(&$predicates) { |
| 258 | 261 | foreach ($predicates as $predicate) { |
| 259 | - if ($predicate($value)) |
|
| 260 | - return true; |
|
| 262 | + if ($predicate($value)) { |
|
| 263 | + return true; |
|
| 264 | + } |
|
| 261 | 265 | } |
| 262 | 266 | return false; |
| 263 | 267 | }); |
@@ -320,8 +324,12 @@ discard block |
||
| 320 | 324 | static $comparator = false; |
| 321 | 325 | $comparator = $comparator ?: curry(function($fn) { |
| 322 | 326 | return function($a, $b) use($fn) { |
| 323 | - if ($fn($a, $b)) return -1; |
|
| 324 | - if ($fn($b, $a)) return 1; |
|
| 327 | + if ($fn($a, $b)) { |
|
| 328 | + return -1; |
|
| 329 | + } |
|
| 330 | + if ($fn($b, $a)) { |
|
| 331 | + return 1; |
|
| 332 | + } |
|
| 325 | 333 | return 0; |
| 326 | 334 | }; |
| 327 | 335 | }); |