Completed
Pull Request — master (#3)
by Amine
02:55
created
src/Internal/_functions.php 1 patch
Braces   +39 added lines, -26 removed lines patch added patch discarded remove patch
@@ -120,25 +120,30 @@  discard block
 block discarded – undo
120 120
     return function() use($fn) {
121 121
         $args = func_get_args();
122 122
         $n = count($args);
123
-        while ($n > 0 && _is_placeholder($args[$n - 1]))
124
-            $n --;
125
-        if ($n == 0)
126
-            return _curry_two($fn);
123
+        while ($n > 0 && _is_placeholder($args[$n - 1])) {
124
+                    $n --;
125
+        }
126
+        if ($n == 0) {
127
+                    return _curry_two($fn);
128
+        }
127 129
         if ($n == 1) {
128 130
             $a = &$args[0];
129
-            if (_is_placeholder($a))
130
-                return _curry_two($fn);
131
+            if (_is_placeholder($a)) {
132
+                            return _curry_two($fn);
133
+            }
131 134
             return _curry_one(function($b) use($fn, &$a) {
132 135
                 return $fn($a, $b);
133 136
             });
134 137
         }
135 138
         $a = &$args[0];
136 139
         $b = &$args[1];
137
-        if (_is_placeholder($a) && _is_placeholder($b))
138
-            return _curry_two($fn);
139
-        if (_is_placeholder($a))
140
-            return _curry_one(function($_a) use($fn, &$b) {
140
+        if (_is_placeholder($a) && _is_placeholder($b)) {
141
+                    return _curry_two($fn);
142
+        }
143
+        if (_is_placeholder($a)) {
144
+                    return _curry_one(function($_a) use($fn, &$b) {
141 145
                 return $fn($_a, $b);
146
+        }
142 147
             });
143 148
         return $fn($args[0], $args[1]);
144 149
     };
@@ -170,10 +175,12 @@  discard block
 block discarded – undo
170 175
     return function() use($fn) {
171 176
         $args = func_get_args();
172 177
         $n = count($args);
173
-        while ($n > 0 && _is_placeholder($args[$n - 1]))
174
-            $n --;
175
-        if ($n == 0)
176
-            return _curry_three($fn);
178
+        while ($n > 0 && _is_placeholder($args[$n - 1])) {
179
+                    $n --;
180
+        }
181
+        if ($n == 0) {
182
+                    return _curry_three($fn);
183
+        }
177 184
         if ($n == 1) {
178 185
             $a = &$args[0];
179 186
             return _curry_two(function($b, $c) use($fn, &$a) {
@@ -183,9 +190,10 @@  discard block
 block discarded – undo
183 190
         if ($n == 2) {
184 191
             $a = &$args[0]; $b = &$args[1];
185 192
 
186
-            if (_is_placeholder($a))
187
-                return _curry_one(function($_a, $c) use(&$b) {
193
+            if (_is_placeholder($a)) {
194
+                            return _curry_one(function($_a, $c) use(&$b) {
188 195
                     return $fn($_a, $b, $c);
196
+            }
189 197
                 });
190 198
             return _curry_one(function($c) use($fn, &$a, &$b) {
191 199
                 return $fn($a, $b, $c);
@@ -194,17 +202,20 @@  discard block
 block discarded – undo
194 202
 
195 203
         $a = &$args[0]; $b = &$args[1]; $c = &$args[2];
196 204
 
197
-        if (_is_placeholder($a) && _is_placeholder($b))
198
-            return _cuury_two(function($_a, $_b) use(&$c) {
205
+        if (_is_placeholder($a) && _is_placeholder($b)) {
206
+                    return _cuury_two(function($_a, $_b) use(&$c) {
199 207
                 return $fn($_a, $_b, $c);
208
+        }
200 209
             });
201
-        if (_is_placeholder($a))
202
-            return _cuury_one(function($_a) use(&$b, &$c) {
210
+        if (_is_placeholder($a)) {
211
+                    return _cuury_one(function($_a) use(&$b, &$c) {
203 212
                 return $fn($_a, $b, $c);
213
+        }
204 214
             });
205
-        if (_is_placeholder($b))
206
-            return _cuury_one(function($_b) use(&$a, &$c) {
215
+        if (_is_placeholder($b)) {
216
+                    return _cuury_one(function($_b) use(&$a, &$c) {
207 217
                 return $fn($a, $_b, $c);
218
+        }
208 219
             });
209 220
 
210 221
         return $fn($a, $b, $c);
@@ -287,8 +298,9 @@  discard block
 block discarded – undo
287 298
             $merged->args[$mergedIndex] = $given[$givenIndex];
288 299
         }
289 300
 
290
-        if (_is_placeholder($merged->args[$mergedIndex]))
291
-            $merged->placeholders ++;
301
+        if (_is_placeholder($merged->args[$mergedIndex])) {
302
+                    $merged->placeholders ++;
303
+        }
292 304
 
293 305
         $givenIndex ++;
294 306
         $mergedIndex ++;
@@ -306,8 +318,9 @@  discard block
 block discarded – undo
306 318
     $argsCount = count($args);
307 319
     $fillersCount = count($fillers);
308 320
     while ($fillersIndex < $fillersCount) {
309
-        while (!_is_placeholder($args[$argsIndex]))
310
-            $argsIndex ++;
321
+        while (!_is_placeholder($args[$argsIndex])) {
322
+                    $argsIndex ++;
323
+        }
311 324
         $args[$argsIndex] = $fillers[$fillersIndex];
312 325
         $fillersIndex ++;
313 326
     }
Please login to merge, or discard this patch.