Completed
Push — master ( f80c85...97f147 )
by Amine
01:50
created
try.php 1 patch
Spacing   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -2,8 +2,7 @@
 block discarded – undo
2 2
 
3 3
 function numberOfArgs($fn) {
4 4
     $reflector = is_array($fn) ?
5
-        new ReflectionMethod($fn[0], $fn[1]) :
6
-        new ReflectionFunction($fn);
5
+        new ReflectionMethod($fn[0], $fn[1]) : new ReflectionFunction($fn);
7 6
     return $reflector->getNumberOfParameters();
8 7
 }
9 8
 
Please login to merge, or discard this patch.
src/functions.php 2 patches
Spacing   +4 added lines, -5 removed lines patch added patch discarded remove patch
@@ -28,8 +28,7 @@  discard block
 block discarded – undo
28 28
  */
29 29
 function _number_of_args($fn) {
30 30
     $reflector = is_array($fn) ?
31
-        new \ReflectionMethod($fn[0], $fn[1]) :
32
-        new \ReflectionFunction($fn);
31
+        new \ReflectionMethod($fn[0], $fn[1]) : new \ReflectionFunction($fn);
33 32
     return $reflector->getNumberOfRequiredParameters();
34 33
 }
35 34
 
@@ -59,7 +58,7 @@  discard block
 block discarded – undo
59 58
     $addArgument = function($currentBoundArgs, $arg) use($fnArgsCount) {
60 59
         $currentBoundArgsCount = count($currentBoundArgs);
61 60
         $placeholderPosition = 0;
62
-        while($placeholderPosition < $currentBoundArgsCount && !_is_placeholder($currentBoundArgs[$placeholderPosition]))
61
+        while ($placeholderPosition < $currentBoundArgsCount && !_is_placeholder($currentBoundArgs[$placeholderPosition]))
63 62
             $placeholderPosition ++;
64 63
         if ($currentBoundArgsCount < $fnArgsCount || $placeholderPosition == $currentBoundArgsCount) {
65 64
             $currentBoundArgs[] = $arg;
@@ -179,9 +178,9 @@  discard block
 block discarded – undo
179 178
  */
180 179
 function pipe() {
181 180
     $fns = func_get_args();
182
-    if(count($fns) < 1)
181
+    if (count($fns) < 1)
183 182
         throw new InvalidArgument("pipe() requires at least one argument");
184
-    return curry(function () use ($fns) {
183
+    return curry(function() use ($fns) {
185 184
         $result = _apply(array_shift($fns), func_get_args());
186 185
         foreach ($fns as $fn) {
187 186
             $result = $fn($result);
Please login to merge, or discard this patch.
Braces   +9 added lines, -6 removed lines patch added patch discarded remove patch
@@ -59,8 +59,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
179 181
  */
180 182
 function pipe() {
181 183
     $fns = func_get_args();
182
-    if(count($fns) < 1)
183
-        throw new InvalidArgument("pipe() requires at least one argument");
184
+    if(count($fns) < 1) {
185
+            throw new InvalidArgument("pipe() requires at least one argument");
186
+    }
184 187
     return curry(function () use ($fns) {
185 188
         $result = _apply(array_shift($fns), func_get_args());
186 189
         foreach ($fns as $fn) {
Please login to merge, or discard this patch.