@@ -119,25 +119,30 @@ discard block |
||
| 119 | 119 | return function() use($fn) { |
| 120 | 120 | $args = func_get_args(); |
| 121 | 121 | $n = count($args); |
| 122 | - while ($n > 0 && _is_placeholder($args[$n - 1])) |
|
| 123 | - $n --; |
|
| 124 | - if ($n == 0) |
|
| 125 | - return _curry_two($fn); |
|
| 122 | + while ($n > 0 && _is_placeholder($args[$n - 1])) { |
|
| 123 | + $n --; |
|
| 124 | + } |
|
| 125 | + if ($n == 0) { |
|
| 126 | + return _curry_two($fn); |
|
| 127 | + } |
|
| 126 | 128 | if ($n == 1) { |
| 127 | 129 | $a = &$args[0]; |
| 128 | - if (_is_placeholder($a)) |
|
| 129 | - return _curry_two($fn); |
|
| 130 | + if (_is_placeholder($a)) { |
|
| 131 | + return _curry_two($fn); |
|
| 132 | + } |
|
| 130 | 133 | return _curry_one(function($b) use($fn, &$a) { |
| 131 | 134 | return $fn($a, $b); |
| 132 | 135 | }); |
| 133 | 136 | } |
| 134 | 137 | $a = &$args[0]; |
| 135 | 138 | $b = &$args[1]; |
| 136 | - if (_is_placeholder($a) && _is_placeholder($b)) |
|
| 137 | - return _curry_two($fn); |
|
| 138 | - if (_is_placeholder($a)) |
|
| 139 | - return _curry_one(function($_a) use($fn, &$b) { |
|
| 139 | + if (_is_placeholder($a) && _is_placeholder($b)) { |
|
| 140 | + return _curry_two($fn); |
|
| 141 | + } |
|
| 142 | + if (_is_placeholder($a)) { |
|
| 143 | + return _curry_one(function($_a) use($fn, &$b) { |
|
| 140 | 144 | return $fn($_a, $b); |
| 145 | + } |
|
| 141 | 146 | }); |
| 142 | 147 | return $fn($args[0], $args[1]); |
| 143 | 148 | }; |
@@ -168,10 +173,12 @@ discard block |
||
| 168 | 173 | return function() use($fn) { |
| 169 | 174 | $args = func_get_args(); |
| 170 | 175 | $n = count($args); |
| 171 | - while ($n > 0 && _is_placeholder($args[$n - 1])) |
|
| 172 | - $n --; |
|
| 173 | - if ($n == 0) |
|
| 174 | - return _curry_three($fn); |
|
| 176 | + while ($n > 0 && _is_placeholder($args[$n - 1])) { |
|
| 177 | + $n --; |
|
| 178 | + } |
|
| 179 | + if ($n == 0) { |
|
| 180 | + return _curry_three($fn); |
|
| 181 | + } |
|
| 175 | 182 | if ($n == 1) { |
| 176 | 183 | $a = &$args[0]; |
| 177 | 184 | return _curry_two(function($b, $c) use($fn, &$a) { |
@@ -181,9 +188,10 @@ discard block |
||
| 181 | 188 | if ($n == 2) { |
| 182 | 189 | $a = &$args[0]; $b = &$args[1]; |
| 183 | 190 | |
| 184 | - if (_is_placeholder($a)) |
|
| 185 | - return _curry_two(function($_a, $c) use($fn, &$b) { |
|
| 191 | + if (_is_placeholder($a)) { |
|
| 192 | + return _curry_two(function($_a, $c) use($fn, &$b) { |
|
| 186 | 193 | return $fn($_a, $b, $c); |
| 194 | + } |
|
| 187 | 195 | }); |
| 188 | 196 | return _curry_one(function($c) use($fn, &$a, &$b) { |
| 189 | 197 | return $fn($a, $b, $c); |
@@ -192,17 +200,20 @@ discard block |
||
| 192 | 200 | |
| 193 | 201 | $a = &$args[0]; $b = &$args[1]; $c = &$args[2]; |
| 194 | 202 | |
| 195 | - if (_is_placeholder($a) && _is_placeholder($b)) |
|
| 196 | - return _curry_two(function($_a, $_b) use($fn, &$c) { |
|
| 203 | + if (_is_placeholder($a) && _is_placeholder($b)) { |
|
| 204 | + return _curry_two(function($_a, $_b) use($fn, &$c) { |
|
| 197 | 205 | return $fn($_a, $_b, $c); |
| 206 | + } |
|
| 198 | 207 | }); |
| 199 | - if (_is_placeholder($a)) |
|
| 200 | - return _curry_one(function($_a) use($fn, &$b, &$c) { |
|
| 208 | + if (_is_placeholder($a)) { |
|
| 209 | + return _curry_one(function($_a) use($fn, &$b, &$c) { |
|
| 201 | 210 | return $fn($_a, $b, $c); |
| 211 | + } |
|
| 202 | 212 | }); |
| 203 | - if (_is_placeholder($b)) |
|
| 204 | - return _curry_one(function($_b) use($fn, &$a, &$c) { |
|
| 213 | + if (_is_placeholder($b)) { |
|
| 214 | + return _curry_one(function($_b) use($fn, &$a, &$c) { |
|
| 205 | 215 | return $fn($a, $_b, $c); |
| 216 | + } |
|
| 206 | 217 | }); |
| 207 | 218 | |
| 208 | 219 | return $fn($a, $b, $c); |
@@ -284,8 +295,9 @@ discard block |
||
| 284 | 295 | $merged->args[$mergedIndex] = $given[$givenIndex]; |
| 285 | 296 | } |
| 286 | 297 | |
| 287 | - if (_is_placeholder($merged->args[$mergedIndex])) |
|
| 288 | - $merged->placeholders ++; |
|
| 298 | + if (_is_placeholder($merged->args[$mergedIndex])) { |
|
| 299 | + $merged->placeholders ++; |
|
| 300 | + } |
|
| 289 | 301 | |
| 290 | 302 | $givenIndex ++; |
| 291 | 303 | $mergedIndex ++; |
@@ -303,8 +315,9 @@ discard block |
||
| 303 | 315 | $argsCount = count($args); |
| 304 | 316 | $fillersCount = count($fillers); |
| 305 | 317 | while ($fillersIndex < $fillersCount) { |
| 306 | - while (!_is_placeholder($args[$argsIndex])) |
|
| 307 | - $argsIndex ++; |
|
| 318 | + while (!_is_placeholder($args[$argsIndex])) { |
|
| 319 | + $argsIndex ++; |
|
| 320 | + } |
|
| 308 | 321 | $args[$argsIndex] = $fillers[$fillersIndex]; |
| 309 | 322 | $fillersIndex ++; |
| 310 | 323 | } |