Completed
Pull Request — master (#2)
by Amine
01:50
created
src/functions.php 1 patch
Braces   +9 added lines, -4 removed lines patch added patch discarded remove patch
@@ -94,8 +94,9 @@  discard block
 block discarded – undo
94 94
  */
95 95
 function pipe() {
96 96
     $fns = func_get_args();
97
-    if(count($fns) < 1)
98
-        return identity();
97
+    if(count($fns) < 1) {
98
+            return identity();
99
+    }
99 100
     return curry(function () use ($fns) {
100 101
         $result = _apply(array_shift($fns), func_get_args());
101 102
         foreach ($fns as $fn) {
@@ -265,8 +266,12 @@  discard block
 block discarded – undo
265 266
     static $comparator = false;
266 267
     $comparator = $comparator ?: curry(function($fn) {
267 268
         return function($a, $b) use($fn) {
268
-            if ($fn($a, $b)) return -1;
269
-            if ($fn($b, $a)) return 1;
269
+            if ($fn($a, $b)) {
270
+                return -1;
271
+            }
272
+            if ($fn($b, $a)) {
273
+                return 1;
274
+            }
270 275
             return 0;
271 276
         };
272 277
     });
Please login to merge, or discard this patch.
src/common.php 1 patch
Braces   +12 added lines, -5 removed lines patch added patch discarded remove patch
@@ -33,9 +33,15 @@  discard block
 block discarded – undo
33 33
 function type() {
34 34
     static $type = false;
35 35
     $type = $type ?: curry(function($data) {
36
-        if ($data instanceof Error) return 'Error';
37
-        if ($data instanceof Stream) return 'Stream';
38
-        if (is_callable($data)) return 'Function';
36
+        if ($data instanceof Error) {
37
+            return 'Error';
38
+        }
39
+        if ($data instanceof Stream) {
40
+            return 'Stream';
41
+        }
42
+        if (is_callable($data)) {
43
+            return 'Function';
44
+        }
39 45
         switch (gettype($data)) {
40 46
             case 'boolean':
41 47
                 return 'Boolean';
@@ -49,8 +55,9 @@  discard block
 block discarded – undo
49 55
             case 'resource':
50 56
                 return 'Resource';
51 57
             case 'array':
52
-                if (allSatisfies('is_numeric', keys($data)))
53
-                    return 'List';
58
+                if (allSatisfies('is_numeric', keys($data))) {
59
+                                    return 'List';
60
+                }
54 61
                 return 'Array';
55 62
             case 'object':
56 63
                 return 'Object';
Please login to merge, or discard this patch.