Completed
Push — master ( d55531...cfe428 )
by Amine
02:42
created
src/functions.php 1 patch
Braces   +9 added lines, -6 removed lines patch added patch discarded remove patch
@@ -57,8 +57,9 @@  discard block
 block discarded – undo
57 57
             $restCount = $allArgsCount - $fnArgsCount;
58 58
             while($placeholdersCount > 0 && $k < $restCount) {
59 59
                 $arg = $rest[$k];
60
-                while(! _is_placeholder($args[$i]))
61
-                    $i++;
60
+                while(! _is_placeholder($args[$i])) {
61
+                                    $i++;
62
+                }
62 63
                 if (! _is_placeholder($arg)) {
63 64
                     $args[$i] = $arg;
64 65
                     $placeholdersCount --;
@@ -93,8 +94,9 @@  discard block
 block discarded – undo
93 94
 function _curried_function($fn, $argsCount, $boundArgs = []) {
94 95
     return function() use($fn, $argsCount, $boundArgs) {
95 96
         $merged = _merge_args($argsCount, $boundArgs, func_get_args());
96
-        if ($merged['count'] >= $argsCount)
97
-            return call_user_func_array($fn, $merged['args']);
97
+        if ($merged['count'] >= $argsCount) {
98
+                    return call_user_func_array($fn, $merged['args']);
99
+        }
98 100
         return _curried_function($fn, $argsCount, $merged['args']);
99 101
     };
100 102
 }
@@ -185,8 +187,9 @@  discard block
 block discarded – undo
185 187
  */
186 188
 function pipe() {
187 189
     $fns = func_get_args();
188
-    if(count($fns) < 1)
189
-        throw new InvalidArgument("pipe() requires at least one argument");
190
+    if(count($fns) < 1) {
191
+            throw new InvalidArgument("pipe() requires at least one argument");
192
+    }
190 193
     return curry(function () use ($fns) {
191 194
         $result = _apply(array_shift($fns), func_get_args());
192 195
         foreach ($fns as $fn) {
Please login to merge, or discard this patch.
src/Placeholder.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -11,8 +11,9 @@
 block discarded – undo
11 11
     private function __construct(){}
12 12
     public static function get()
13 13
     {
14
-        if(static::$instance === null)
15
-            static::$instance = new Placeholder;
14
+        if(static::$instance === null) {
15
+                    static::$instance = new Placeholder;
16
+        }
16 17
         return static::$instance;
17 18
     }
18 19
     public function __toString(){
Please login to merge, or discard this patch.
try.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -14,8 +14,9 @@
 block discarded – undo
14 14
 function curriedFunction($fn, $argsCount, $boundArgs = []) {
15 15
     return function() use($fn, $argsCount, $boundArgs) {
16 16
         $boundArgs = array_merge($boundArgs, func_get_args());
17
-        if (count($boundArgs) >= $argsCount)
18
-            return call_user_func_array($fn, $boundArgs);
17
+        if (count($boundArgs) >= $argsCount) {
18
+                    return call_user_func_array($fn, $boundArgs);
19
+        }
19 20
         return curriedFunction($fn, $argsCount, $boundArgs);
20 21
     };
21 22
 }
Please login to merge, or discard this patch.