Completed
Push — master ( 5e2d42...f80c85 )
by Amine
02:13
created
src/math.php 2 patches
Doc Comments   -10 removed lines patch added patch discarded remove patch
@@ -11,8 +11,6 @@  discard block
 block discarded – undo
11 11
  * ```
12 12
  *
13 13
  * @signature Number -> Number -> Number
14
- * @param  int|float $x
15
- * @param  int|float $y
16 14
  * @return int|float
17 15
  */
18 16
 function plus() {
@@ -29,8 +27,6 @@  discard block
 block discarded – undo
29 27
  * ```
30 28
  *
31 29
  * @signature Number -> Number -> Number
32
- * @param  int|float $x
33
- * @param  int|float $y
34 30
  * @return int|float
35 31
  */
36 32
 function minus() {
@@ -63,8 +59,6 @@  discard block
 block discarded – undo
63 59
  * ```
64 60
  *
65 61
  * @signature Number -> Number -> Number
66
- * @param  int|float $x
67
- * @param  int|float $y
68 62
  * @return int|float
69 63
  */
70 64
 function multiply() {
@@ -81,8 +75,6 @@  discard block
 block discarded – undo
81 75
  * ```
82 76
  *
83 77
  * @signature Number -> Number -> Number
84
- * @param  int|float $x
85
- * @param  int|float $y
86 78
  * @return int|float
87 79
  */
88 80
 function divide() {
@@ -99,8 +91,6 @@  discard block
 block discarded – undo
99 91
  * ```
100 92
  *
101 93
  * @signature Number -> Number -> Number
102
- * @param  int|float $x
103
- * @param  int|float $y
104 94
  * @return int|float
105 95
  */
106 96
 function modulo() {
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
  * @return int|float
17 17
  */
18 18
 function plus() {
19
-    $plus = curry(function($x, $y){
19
+    $plus = curry(function($x, $y) {
20 20
         return $x + $y;
21 21
     });
22 22
     return apply($plus, func_get_args());
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
  * @return int|float
35 35
  */
36 36
 function minus() {
37
-    $minus = curry(function($x, $y){
37
+    $minus = curry(function($x, $y) {
38 38
         return $x - $y;
39 39
     });
40 40
     return apply($minus, func_get_args());
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
  * @return int|float
53 53
  */
54 54
 function negate($x) {
55
-    return -$x;
55
+    return - $x;
56 56
 }
57 57
 
58 58
 /**
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
  * @return int|float
69 69
  */
70 70
 function multiply() {
71
-    $multiply = curry(function($x, $y){
71
+    $multiply = curry(function($x, $y) {
72 72
         return $y * $x;
73 73
     });
74 74
     return apply($multiply, func_get_args());
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
  * @return int|float
87 87
  */
88 88
 function divide() {
89
-    $divide = curry(function($x, $y){
89
+    $divide = curry(function($x, $y) {
90 90
         return $x / $y;
91 91
     });
92 92
     return apply($divide, func_get_args());
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
  * @return int|float
105 105
  */
106 106
 function modulo() {
107
-    $modulo = curry(function($x, $y){
107
+    $modulo = curry(function($x, $y) {
108 108
         return $x % $y;
109 109
     });
110 110
     return apply($modulo, func_get_args());
Please login to merge, or discard this patch.
src/Stream.php 3 patches
Doc Comments   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -94,6 +94,7 @@  discard block
 block discarded – undo
94 94
      *
95 95
      * @param  mixed $data
96 96
      * @param  array $operations
97
+     * @param boolean $type
97 98
      * @return Stream
98 99
      */
99 100
     protected static function with ($data, $operations, $type)
@@ -414,7 +415,6 @@  discard block
 block discarded – undo
414 415
      *
415 416
      * @signature Stream(a) -> (String, ...) -> Stream(*)
416 417
      * @param  string $method
417
-     * @param  mixed|null $args...
418 418
      * @return Stream
419 419
      */
420 420
     public function call ($method)
@@ -468,7 +468,6 @@  discard block
 block discarded – undo
468 468
      *
469 469
      * @signature Stream(a) -> (String, ...) -> Stream(a)
470 470
      * @param  string $method
471
-     * @param  mixed|null $args...
472 471
      * @return Stream
473 472
      */
474 473
     public function run ($method)
Please login to merge, or discard this patch.
Braces   +18 added lines, -12 removed lines patch added patch discarded remove patch
@@ -84,8 +84,9 @@  discard block
 block discarded – undo
84 84
     public static function of ($data)
85 85
     {
86 86
         $data = func_get_args();
87
-        if (count($data) == 1)
88
-            $data = $data[0];
87
+        if (count($data) == 1) {
88
+                    $data = $data[0];
89
+        }
89 90
         return new Stream($data, [], type($data));
90 91
     }
91 92
 
@@ -122,8 +123,9 @@  discard block
 block discarded – undo
122 123
      */
123 124
     protected static function execute ($operations, $data)
124 125
     {
125
-        if (length($operations) == 0)
126
-            return $data;
126
+        if (length($operations) == 0) {
127
+                    return $data;
128
+        }
127 129
         $operations = apply('Tarsana\\Functional\\pipe', map(function($operation){
128 130
             if ($operation['name'] == 'apply') {
129 131
                 return $operation['args'];
@@ -234,8 +236,9 @@  discard block
 block discarded – undo
234 236
      */
235 237
     public function get ()
236 238
     {
237
-        if ($this->type == 'Error')
238
-            return $this->data;
239
+        if ($this->type == 'Error') {
240
+                    return $this->data;
241
+        }
239 242
         return Stream::execute($this->operations, $this->data);
240 243
     }
241 244
 
@@ -421,11 +424,13 @@  discard block
 block discarded – undo
421 424
     {
422 425
         $args = tail(func_get_args());
423 426
         return Stream::apply('apply', function($data) use($method, $args) {
424
-            if (is_callable([$data, $method]))
425
-                return call_user_func_array([$data, $method], $args);
427
+            if (is_callable([$data, $method])) {
428
+                            return call_user_func_array([$data, $method], $args);
429
+            }
426 430
             $text = toString($data);
427
-            if (method_exists($data, $method))
428
-                return Error::of("Method '{$method}' of {$text} is not accessible");
431
+            if (method_exists($data, $method)) {
432
+                            return Error::of("Method '{$method}' of {$text} is not accessible");
433
+            }
429 434
             return Error::of("Method '{$method}' of {$text} is not found");
430 435
         }, $this);
431 436
     }
@@ -480,8 +485,9 @@  discard block
 block discarded – undo
480 485
                 return $data;
481 486
             }
482 487
             $text = toString($data);
483
-            if (method_exists($data, $method))
484
-                return Error::of("Method '{$method}' of {$text} is not accessible");
488
+            if (method_exists($data, $method)) {
489
+                            return Error::of("Method '{$method}' of {$text} is not accessible");
490
+            }
485 491
             return Error::of("Method '{$method}' of {$text} is not found");
486 492
         }, $this);
487 493
     }
Please login to merge, or discard this patch.
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
      * @param  mixed $data
82 82
      * @return Stream
83 83
      */
84
-    public static function of ($data)
84
+    public static function of($data)
85 85
     {
86 86
         $data = func_get_args();
87 87
         if (count($data) == 1)
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
      * @param  array $operations
97 97
      * @return Stream
98 98
      */
99
-    protected static function with ($data, $operations, $type)
99
+    protected static function with($data, $operations, $type)
100 100
     {
101 101
         return new Stream($data, $operations, $type);
102 102
     }
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
      * @param  array $operations
108 108
      * @return array|Error
109 109
      */
110
-    protected static function optimize ($operations)
110
+    protected static function optimize($operations)
111 111
     {
112 112
         // TODO: ...
113 113
         return $operations;
@@ -120,11 +120,11 @@  discard block
 block discarded – undo
120 120
      * @param  mixed $data
121 121
      * @return mixed|Error
122 122
      */
123
-    protected static function execute ($operations, $data)
123
+    protected static function execute($operations, $data)
124 124
     {
125 125
         if (length($operations) == 0)
126 126
             return $data;
127
-        $operations = apply(_f('pipe'), map(function($operation){
127
+        $operations = apply(_f('pipe'), map(function($operation) {
128 128
             if ($operation['name'] == 'apply') {
129 129
                 return $operation['args'];
130 130
             }
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
      * @param  string $type
143 143
      * @return bool
144 144
      */
145
-    protected static function canApply ($operation, $type)
145
+    protected static function canApply($operation, $type)
146 146
     {
147 147
         return isset(Stream::$transformations[$operation]) && (
148 148
             $type == 'Unknown' ||
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
      * @param  string $type
159 159
      * @return bool
160 160
      */
161
-    protected static function returnOf ($operation, $type)
161
+    protected static function returnOf($operation, $type)
162 162
     {
163 163
         return isset(Stream::$transformations[$operation][$type])
164 164
             ? Stream::$transformations[$operation][$type]
@@ -173,12 +173,12 @@  discard block
 block discarded – undo
173 173
      * @param  Stream $stream
174 174
      * @return Stream
175 175
      */
176
-    protected static function apply ($operation, $args, $stream)
176
+    protected static function apply($operation, $args, $stream)
177 177
     {
178 178
         if ($stream->type == 'Error') {
179 179
             return Stream::of(Error::of("Could not apply {$operation} to {$stream->type}", $stream->data));
180 180
         }
181
-        if (! Stream::canApply($operation, $stream->type)) {
181
+        if (!Stream::canApply($operation, $stream->type)) {
182 182
             $data = toString($stream->data);
183 183
             return Stream::of(Error::of("Could not apply {$operation} to {$stream->type}({$data})"));
184 184
         }
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
      *
195 195
      * @param mixed $data
196 196
      */
197
-    protected function __construct ($data, $operations, $type)
197
+    protected function __construct($data, $operations, $type)
198 198
     {
199 199
         $this->data = $data;
200 200
         $this->type = $type;
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
      * @signature Stream(a) -> a
233 233
      * @return mixed
234 234
      */
235
-    public function get ()
235
+    public function get()
236 236
     {
237 237
         if ($this->type == 'Error')
238 238
             return $this->data;
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
      * @param  callable $fn
252 252
      * @return Stream
253 253
      */
254
-    public function map (callable $fn)
254
+    public function map(callable $fn)
255 255
     {
256 256
         return Stream::apply('map', [$fn], $this);
257 257
     }
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
      * @param  callable $predicate
269 269
      * @return Stream
270 270
      */
271
-    public function filter (callable $predicate)
271
+    public function filter(callable $predicate)
272 272
     {
273 273
         return Stream::apply('filter', [$predicate], $this);
274 274
     }
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
      * @param mixed $initial
287 287
      * @return Stream
288 288
      */
289
-    public function reduce ($fn, $initial)
289
+    public function reduce($fn, $initial)
290 290
     {
291 291
         return Stream::apply('reduce', [$fn, $initial], $this);
292 292
     }
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
      * @param callable $fn
306 306
      * @return Stream
307 307
      */
308
-    public function chain ($fn)
308
+    public function chain($fn)
309 309
     {
310 310
         return Stream::apply('chain', [$fn], $this);
311 311
     }
@@ -325,7 +325,7 @@  discard block
 block discarded – undo
325 325
      * @signature Stream(String) -> Number
326 326
      * @return Stream
327 327
      */
328
-    public function length ()
328
+    public function length()
329 329
     {
330 330
         return Stream::apply('length', [], $this);
331 331
     }
@@ -346,7 +346,7 @@  discard block
 block discarded – undo
346 346
      * @param int $number
347 347
      * @return Stream
348 348
      */
349
-    public function take ($number)
349
+    public function take($number)
350 350
     {
351 351
         return Stream::apply('take', [$number], $this);
352 352
     }
@@ -367,7 +367,7 @@  discard block
 block discarded – undo
367 367
      * @param callable $fn
368 368
      * @return Stream
369 369
      */
370
-    public function then ($fn)
370
+    public function then($fn)
371 371
     {
372 372
         $result = $this;
373 373
         foreach (func_get_args() as $fn) {
@@ -417,7 +417,7 @@  discard block
 block discarded – undo
417 417
      * @param  mixed|null $args...
418 418
      * @return Stream
419 419
      */
420
-    public function call ($method)
420
+    public function call($method)
421 421
     {
422 422
         $args = tail(func_get_args());
423 423
         return Stream::apply('apply', function($data) use($method, $args) {
@@ -471,7 +471,7 @@  discard block
 block discarded – undo
471 471
      * @param  mixed|null $args...
472 472
      * @return Stream
473 473
      */
474
-    public function run ($method)
474
+    public function run($method)
475 475
     {
476 476
         $args = tail(func_get_args());
477 477
         return Stream::apply('apply', function($data) use($method, $args) {
Please login to merge, or discard this patch.
src/string.php 2 patches
Doc Comments   -25 removed lines patch added patch discarded remove patch
@@ -11,8 +11,6 @@  discard block
 block discarded – undo
11 11
  * ```
12 12
  *
13 13
  * @signature String -> String -> [String]
14
- * @param string $delimiter
15
- * @param string $string
16 14
  * @return array
17 15
  */
18 16
 function split() {
@@ -27,8 +25,6 @@  discard block
 block discarded – undo
27 25
  * ```
28 26
  *
29 27
  * @signature String -> [String] -> String
30
- * @param string $glue
31
- * @param array $pieces
32 28
  * @return string
33 29
  */
34 30
 function join() {
@@ -48,9 +44,6 @@  discard block
 block discarded – undo
48 44
  * ```
49 45
  *
50 46
  * @signature String|[String] -> String -> String|[String] -> String
51
- * @param  string $search
52
- * @param  string $replacement
53
- * @param  string $string
54 47
  * @return string
55 48
  */
56 49
 function replace() {
@@ -66,9 +59,6 @@  discard block
 block discarded – undo
66 59
  * ```
67 60
  *
68 61
  * @signature String -> String -> String -> String
69
- * @param  string $pattern
70
- * @param  string $replacement
71
- * @param  string $string
72 62
  * @return string
73 63
  */
74 64
 function regReplace() {
@@ -131,8 +121,6 @@  discard block
 block discarded – undo
131 121
  * ```
132 122
  *
133 123
  * @signature String -> String -> String
134
- * @param  string $delimiter
135
- * @param  string $string
136 124
  * @return string
137 125
  */
138 126
 function snakeCase() {
@@ -158,8 +146,6 @@  discard block
 block discarded – undo
158 146
  * ```
159 147
  *
160 148
  * @signature String -> String -> Boolean
161
- * @param  string $token
162
- * @param  string $string
163 149
  * @return bool
164 150
  */
165 151
 function startsWith() {
@@ -181,8 +167,6 @@  discard block
 block discarded – undo
181 167
  * ```
182 168
  *
183 169
  * @signature String -> String -> Boolean
184
- * @param  string $token
185
- * @param  string $string
186 170
  * @return bool
187 171
  */
188 172
 function endsWith() {
@@ -204,8 +188,6 @@  discard block
 block discarded – undo
204 188
  * ```
205 189
  *
206 190
  * @signature String -> String -> Boolean
207
- * @param  string $pattern
208
- * @param  string $string
209 191
  * @return bool
210 192
  */
211 193
 function test() {
@@ -225,8 +207,6 @@  discard block
 block discarded – undo
225 207
  * ```
226 208
  *
227 209
  * @signature String -> String -> [String]
228
- * @param  string $pattern
229
- * @param  string $string
230 210
  * @return array
231 211
  */
232 212
 function match() {
@@ -247,8 +227,6 @@  discard block
 block discarded – undo
247 227
  * ```
248 228
  *
249 229
  * @signature String -> String -> Number
250
- * @param  string $token
251
- * @param  string $text
252 230
  * @return int
253 231
  */
254 232
 function occurences() {
@@ -271,9 +249,6 @@  discard block
 block discarded – undo
271 249
  * ```
272 250
  *
273 251
  * @signature String -> String -> String -> [String]
274
- * @param  string $surrounders
275
- * @param  string $separator
276
- * @param  sring $text
277 252
  * @return array
278 253
  */
279 254
 function chunks() {
Please login to merge, or discard this patch.
Spacing   +3 added lines, -4 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
  * @return string
33 33
  */
34 34
 function join() {
35
-    return apply(curry(function($glue, $pieces){
35
+    return apply(curry(function($glue, $pieces) {
36 36
         return implode($glue, $pieces);
37 37
     }), func_get_args());
38 38
 }
@@ -285,8 +285,7 @@  discard block
 block discarded – undo
285 285
                 $count = occurences(__(), $item);
286 286
                 $counts = map(function($index) use ($result, $count) {
287 287
                     return ($result->openings[$index] == $result->closings[$index]) ?
288
-                        ($result->counts[$index] + $count($result->openings[$index])) % 2 :
289
-                        $result->counts[$index] + $count($result->openings[$index]) - $count($result->closings[$index]);
288
+                        ($result->counts[$index] + $count($result->openings[$index])) % 2 : $result->counts[$index] + $count($result->openings[$index]) - $count($result->closings[$index]);
290 289
                 }, range(0, length($result->counts) - 1));
291 290
                 if (0 == $result->total) {
292 291
                     return (object) [
@@ -311,7 +310,7 @@  discard block
 block discarded – undo
311 310
                 'counts'   => array_fill(0, length($surrounders), 0),
312 311
                 'total'    => 0
313 312
             ])
314
-            ->then(function($data){
313
+            ->then(function($data) {
315 314
                 return $data->items;
316 315
             })
317 316
             ->get();
Please login to merge, or discard this patch.
src/Error.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
      * @param  Error|null $error
25 25
      * @return Error
26 26
      */
27
-    public static function of ($message, Error $error = null)
27
+    public static function of($message, Error $error = null)
28 28
     {
29 29
         return new Error($message, $error);
30 30
     }
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
      * @param string     $message
36 36
      * @param Error|null $error
37 37
      */
38
-    protected function __construct ($message, Error $error = null)
38
+    protected function __construct($message, Error $error = null)
39 39
     {
40 40
         if (null != $error)
41 41
             $message = $error->message() . ' -> ' . $message;
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
      * @signature Error -> String
53 53
      * @return string
54 54
      */
55
-    public function message ()
55
+    public function message()
56 56
     {
57 57
         return $this->message;
58 58
     }
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -37,8 +37,9 @@
 block discarded – undo
37 37
      */
38 38
     protected function __construct ($message, Error $error = null)
39 39
     {
40
-        if (null != $error)
41
-            $message = $error->message() . ' -> ' . $message;
40
+        if (null != $error) {
41
+                    $message = $error->message() . ' -> ' . $message;
42
+        }
42 43
         $this->message = $message;
43 44
     }
44 45
 
Please login to merge, or discard this patch.
src/common.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
  * @param  mixed $something
72 72
  * @return string
73 73
  */
74
-function toString ($something) {
74
+function toString($something) {
75 75
     switch (type($something)) {
76 76
         case 'String':
77 77
             return $something;
@@ -90,8 +90,8 @@  discard block
 block discarded – undo
90 90
         break;
91 91
         case 'ArrayObject':
92 92
         case 'Array':
93
-            return '[' . join(', ', map(function($pair){
94
-                return $pair[0].' => '. toString($pair[1]);
93
+            return '[' . join(', ', map(function($pair) {
94
+                return $pair[0] . ' => ' . toString($pair[1]);
95 95
             }, toPairs($something))) . ']';
96 96
         break;
97 97
         case 'Error':
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
             return is_callable([$something, '__toString']) ? $something->__toString() : '[Object]';
101 101
         break;
102 102
         default:
103
-            return '['.type($something).']';
103
+            return '[' . type($something) . ']';
104 104
     }
105 105
 }
106 106
 
Please login to merge, or discard this patch.
Braces   +33 added lines, -13 removed lines patch added patch discarded remove patch
@@ -27,22 +27,42 @@
 block discarded – undo
27 27
  * @return string
28 28
  */
29 29
 function type($data) {
30
-    if (null === $data) return 'Null';
31
-    if (true === $data || false === $data) return 'Boolean';
32
-    if ($data instanceof Error) return 'Error';
33
-    if ($data instanceof Stream) return 'Stream';
34
-    if (is_callable($data)) return 'Function';
35
-    if (is_resource($data)) return 'Resource';
36
-    if (is_string($data)) return 'String';
37
-    if (is_integer($data) || is_float($data)) return 'Number';
30
+    if (null === $data) {
31
+        return 'Null';
32
+    }
33
+    if (true === $data || false === $data) {
34
+        return 'Boolean';
35
+    }
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
+    }
45
+    if (is_resource($data)) {
46
+        return 'Resource';
47
+    }
48
+    if (is_string($data)) {
49
+        return 'String';
50
+    }
51
+    if (is_integer($data) || is_float($data)) {
52
+        return 'Number';
53
+    }
38 54
     if (is_array($data)) {
39
-        if (all('is_numeric', array_keys($data)))
40
-            return 'List';
41
-        if (all('is_string', array_keys($data)))
42
-            return 'ArrayObject';
55
+        if (all('is_numeric', array_keys($data))) {
56
+                    return 'List';
57
+        }
58
+        if (all('is_string', array_keys($data))) {
59
+                    return 'ArrayObject';
60
+        }
43 61
         return 'Array';
44 62
     }
45
-    if (is_object($data)) return 'Object';
63
+    if (is_object($data)) {
64
+        return 'Object';
65
+    }
46 66
     return 'Unknown';
47 67
 }
48 68
 
Please login to merge, or discard this patch.
generate-docs.php 2 patches
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
 // Reads the list of sources files from 'composer.json'
18 18
 // * -> IO [String]
19 19
 function modules() {
20
-    $composer = json_decode(file_get_contents(__DIR__.'/composer.json'));
20
+    $composer = json_decode(file_get_contents(__DIR__ . '/composer.json'));
21 21
     return $composer->autoload->files;
22 22
 }
23 23
 
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
  * @field type String
40 40
  */
41 41
 function argsOf($data) {
42
-    return F\map(function($tag){
42
+    return F\map(function($tag) {
43 43
         return (object) [
44 44
             'type' => $tag->name,
45 45
             'name' => $tag->description
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 // Extracts signatures of a function.
51 51
 // Object -> [String]
52 52
 function signaturesOf($data) {
53
-    return F\map(function($tag){
53
+    return F\map(function($tag) {
54 54
         return $tag->string;
55 55
     }, tags('signature', $data));
56 56
 }
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 // Get a markdown code block
125 125
 // String -> String -> String
126 126
 function code($lang, $text) {
127
-    if(trim($text) == '')
127
+    if (trim($text) == '')
128 128
         return '';
129 129
     return "```{$lang}\n{$text}\n```";
130 130
 }
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
         $args = F\map(function($arg) {
139 139
             return $arg->type . ' ' . $arg->name;
140 140
         }, $fn->args);
141
-        $proto = $fn->name . '('. F\join(', ', $args) .') : ' . $fn->return;
141
+        $proto = $fn->name . '(' . F\join(', ', $args) . ') : ' . $fn->return;
142 142
         return F\join("\n\n", [
143 143
             "## {$fn->name}",
144 144
             code('php', $proto),
@@ -153,11 +153,11 @@  discard block
 block discarded – undo
153 153
 function addContents() {
154 154
     $addContents = function($name, $parts) {
155 155
         $names = F\filter(F\notEq($name), F\map(F\value('name'), $parts));
156
-        $contents = F\map(function ($partname) use($name) {
156
+        $contents = F\map(function($partname) use($name) {
157 157
             $link = URL . "/docs/{$name}.md#{$partname}";
158 158
             return "- [{$partname}]($link)";
159 159
         }, $names);
160
-        file_put_contents ("docs/README.md",
160
+        file_put_contents("docs/README.md",
161 161
             F\join("\n\n", F\concat(["## {$name}"], $contents)) . "\n\n"
162 162
         , FILE_APPEND);
163 163
         return array_merge(['# ' . $name, '## Table Of Contents'], $contents, F\map(F\value('md'), $parts));
@@ -169,10 +169,10 @@  discard block
 block discarded – undo
169 169
 function generateModule($file) {
170 170
     $content = F\pipe(
171 171
         F\map('Demo\\block'),
172
-        F\filter(function($block){
172
+        F\filter(function($block) {
173 173
             return $block->type == 'function' && !$block->is_internal;
174 174
         }),
175
-        F\map(function($block){
175
+        F\map(function($block) {
176 176
             return [
177 177
                 'name' => $block->name,
178 178
                 'md' => markdown($block)
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
         F\join("\n\n")
183 183
     );
184 184
 
185
-    file_put_contents (
185
+    file_put_contents(
186 186
         F\replace(['src', '.php'], ['docs', '.md'], $file),
187 187
         $content(json_decode(shell_exec("dox -r < {$file}")))
188 188
     );
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
 function generateClass($name) {
194 194
     $content = F\pipe(
195 195
         F\map('Demo\\block'),
196
-        F\filter(function($block){
196
+        F\filter(function($block) {
197 197
             return in_array($block->type, ['method', 'class']) && !$block->is_internal;
198 198
         }),
199 199
         f\map(function($block) use ($name) {
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
             }
203 203
             return $block;
204 204
         }),
205
-        F\map(function($block){
205
+        F\map(function($block) {
206 206
             return [
207 207
                 'name' => $block->name,
208 208
                 'md' => markdown($block)
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
         F\join("\n\n")
213 213
     );
214 214
 
215
-    file_put_contents (
215
+    file_put_contents(
216 216
         "docs/{$name}.md",
217 217
         $content(json_decode(shell_exec("dox -r < src/{$name}.php")))
218 218
     );
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
 
221 221
 // The entry point
222 222
 file_put_contents('docs/README.md', "# Reference Documentation \n\n");
223
-file_put_contents ("docs/README.md", "# Function Modules\n\n" , FILE_APPEND);
223
+file_put_contents("docs/README.md", "# Function Modules\n\n", FILE_APPEND);
224 224
 F\each('Demo\\generateModule', modules());
225
-file_put_contents ("docs/README.md", "# Containers\n\n" , FILE_APPEND);
225
+file_put_contents("docs/README.md", "# Containers\n\n", FILE_APPEND);
226 226
 F\each('Demo\\generateClass', ['Stream', 'Error']);
Please login to merge, or discard this patch.
Braces   +16 added lines, -11 removed lines patch added patch discarded remove patch
@@ -67,13 +67,16 @@  discard block
 block discarded – undo
67 67
 // Extracts the type of a block
68 68
 // Object -> String
69 69
 function typeOf($data) {
70
-    if (isset($data->ctx->type))
71
-        return $data->ctx->type;
72
-    if (F\length(tags('var', $data)) > 0)
73
-        return 'attr';
74
-    if (F\length(tags('return', $data)) > 0)
75
-        return 'method';
76
-}
70
+    if (isset($data->ctx->type)) {
71
+            return $data->ctx->type;
72
+    }
73
+    if (F\length(tags('var', $data)) > 0) {
74
+            return 'attr';
75
+    }
76
+    if (F\length(tags('return', $data)) > 0) {
77
+            return 'method';
78
+    }
79
+    }
77 80
 
78 81
 // Extract keywords
79 82
 // Object -> [String]
@@ -82,8 +85,9 @@  discard block
 block discarded – undo
82 85
         return [];
83 86
     }
84 87
     $size = strpos($data->code, '(');
85
-    if ($size === false)
86
-        $size = strlen($data->code);
88
+    if ($size === false) {
89
+            $size = strlen($data->code);
90
+    }
87 91
     $keywords = F\pipe(
88 92
         F\take($size),
89 93
         F\split(' '),
@@ -124,8 +128,9 @@  discard block
 block discarded – undo
124 128
 // Get a markdown code block
125 129
 // String -> String -> String
126 130
 function code($lang, $text) {
127
-    if(trim($text) == '')
128
-        return '';
131
+    if(trim($text) == '') {
132
+            return '';
133
+    }
129 134
     return "```{$lang}\n{$text}\n```";
130 135
 }
131 136
 
Please login to merge, or discard this patch.
src/list.php 3 patches
Doc Comments   -70 removed lines patch added patch discarded remove patch
@@ -11,8 +11,6 @@  discard block
 block discarded – undo
11 11
  * ```
12 12
  *
13 13
  * @signature (a -> b) -> [a] -> [b]
14
- * @param  callable $fn
15
- * @param  array $list
16 14
  * @return array
17 15
  */
18 16
 function map() {
@@ -31,8 +29,6 @@  discard block
 block discarded – undo
31 29
  * ```
32 30
  *
33 31
  * @signature (a -> [b]) -> [a] -> [b]
34
- * @param  callable $fn
35
- * @param  array $list
36 32
  * @return array
37 33
  */
38 34
 function chain() {
@@ -51,8 +47,6 @@  discard block
 block discarded – undo
51 47
  * $numeric($list) // [1, 3]
52 48
  * ```
53 49
  * @signature (a -> Boolean) -> [a] -> [a]
54
- * @param  callable $fn
55
- * @param  array $list
56 50
  * @return array
57 51
  */
58 52
 function filter() {
@@ -72,9 +66,6 @@  discard block
 block discarded – undo
72 66
  * ```
73 67
  *
74 68
  * @signature (* -> a -> *) -> * -> [a] -> *
75
- * @param  callable $fn
76
- * @param  mixed $initial
77
- * @param  array $list
78 69
  * @return array
79 70
  */
80 71
 function reduce() {
@@ -99,8 +90,6 @@  discard block
 block discarded – undo
99 90
  * ```
100 91
  *
101 92
  * @signature (a -> *) -> [a] -> [a]
102
- * @param  callable $fn
103
- * @param  array $list
104 93
  * @return array
105 94
  */
106 95
 function each() {
@@ -252,8 +241,6 @@  discard block
 block discarded – undo
252 241
  * ```
253 242
  *
254 243
  * @signature (a -> Boolean) -> [a] -> Boolean
255
- * @param  callable $predicate
256
- * @param  array $list
257 244
  * @return bool
258 245
  */
259 246
 function all() {
@@ -273,8 +260,6 @@  discard block
 block discarded – undo
273 260
  * ```
274 261
  *
275 262
  * @signature (a -> Boolean) -> [a] -> Boolean
276
- * @param  callable $predicate
277
- * @param  array $list
278 263
  * @return bool
279 264
  */
280 265
 function any() {
@@ -293,8 +278,6 @@  discard block
 block discarded – undo
293 278
  *
294 279
  * @signature [*] -> [*] -> [*]
295 280
  * @signature String -> String -> String
296
- * @param  array $list1
297
- * @param  array $list2
298 281
  * @return array
299 282
  */
300 283
 function concat() {
@@ -314,7 +297,6 @@  discard block
 block discarded – undo
314 297
  * ```
315 298
  *
316 299
  * @signature [[a]] -> [a]
317
- * @param  array $lists
318 300
  * @return array
319 301
  */
320 302
 function concatAll() {
@@ -338,9 +320,6 @@  discard block
 block discarded – undo
338 320
  *
339 321
  * @signature Number -> a -> [a] -> [a]
340 322
  * @signature Number -> String -> String -> String
341
- * @param  int $position
342
- * @param  mixed $item
343
- * @param  array $list
344 323
  * @return array
345 324
  */
346 325
 function insert() {
@@ -365,9 +344,6 @@  discard block
 block discarded – undo
365 344
  *
366 345
  * @signature Number -> [a] -> [a] -> [a]
367 346
  * @signature Number -> String -> String -> String
368
- * @param  int $position
369
- * @param  mixed $items
370
- * @param  array $list
371 347
  * @return array
372 348
  */
373 349
 function insertAll() {
@@ -388,8 +364,6 @@  discard block
 block discarded – undo
388 364
  *
389 365
  * @signature * -> [*] -> [*]
390 366
  * @signature String -> String -> String
391
- * @param  mixed $item
392
- * @param  array $list
393 367
  * @return array
394 368
  */
395 369
 function append() {
@@ -409,8 +383,6 @@  discard block
 block discarded – undo
409 383
  *
410 384
  * @signature a -> [a] -> [a]
411 385
  * @signature String -> String -> String
412
- * @param  mixed $item
413
- * @param  array $list
414 386
  * @return array
415 387
  */
416 388
 function prepend() {
@@ -431,8 +403,6 @@  discard block
 block discarded – undo
431 403
  *
432 404
  * @signature Number -> [a] -> [a]
433 405
  * @signature Number -> String -> String
434
- * @param  int $count
435
- * @param  array $list
436 406
  * @return array
437 407
  */
438 408
 function take() {
@@ -461,8 +431,6 @@  discard block
 block discarded – undo
461 431
  * ```
462 432
  *
463 433
  * @signature (a -> Boolean) -> [a] -> [a]
464
- * @param  callable $predicate
465
- * @param  array $list
466 434
  * @return array
467 435
  */
468 436
 function takeWhile() {
@@ -485,8 +453,6 @@  discard block
 block discarded – undo
485 453
  * ```
486 454
  *
487 455
  * @signature (a -> Boolean) -> [a] -> [a]
488
- * @param  callable $predicate
489
- * @param  array $list
490 456
  * @return array
491 457
  */
492 458
 function takeLastWhile() {
@@ -510,8 +476,6 @@  discard block
 block discarded – undo
510 476
  * ```
511 477
  *
512 478
  * @signature (a -> Boolean) -> [a] -> [a]
513
- * @param  callable $predicate
514
- * @param  array $list
515 479
  * @return array
516 480
  */
517 481
 function takeUntil() {
@@ -530,8 +494,6 @@  discard block
 block discarded – undo
530 494
  * ```
531 495
  *
532 496
  * @signature (a -> Boolean) -> [a] -> [a]
533
- * @param  callable $predicate
534
- * @param  array $list
535 497
  * @return array
536 498
  */
537 499
 function takeLastUntil() {
@@ -556,8 +518,6 @@  discard block
 block discarded – undo
556 518
  *
557 519
  * @signature Number -> [a] -> [a]
558 520
  * @signature Number -> String -> String
559
- * @param  int $count
560
- * @param  array $list
561 521
  * @return array
562 522
  */
563 523
 function remove() {
@@ -582,8 +542,6 @@  discard block
 block discarded – undo
582 542
  * ```
583 543
  *
584 544
  * @signature (a -> Boolean) -> [a] -> [a]
585
- * @param  callable $predicate
586
- * @param  array $list
587 545
  * @return array
588 546
  */
589 547
 function removeWhile() {
@@ -602,8 +560,6 @@  discard block
 block discarded – undo
602 560
  * ```
603 561
  *
604 562
  * @signature (a -> Boolean) -> [a] -> [a]
605
- * @param  callable $predicate
606
- * @param  array $list
607 563
  * @return array
608 564
  */
609 565
 function removeLastWhile() {
@@ -624,8 +580,6 @@  discard block
 block discarded – undo
624 580
  * ```
625 581
  *
626 582
  * @signature (a -> Boolean) -> [a] -> [a]
627
- * @param  callable $predicate
628
- * @param  array $list
629 583
  * @return array
630 584
  */
631 585
 function removeUntil() {
@@ -645,8 +599,6 @@  discard block
 block discarded – undo
645 599
  * ```
646 600
  *
647 601
  * @signature (a -> Boolean) -> [a] -> [a]
648
- * @param  callable $predicate
649
- * @param  array $list
650 602
  * @return array
651 603
  */
652 604
 function removeLastUntil() {
@@ -663,7 +615,6 @@  discard block
 block discarded – undo
663 615
  * ```
664 616
  *
665 617
  * @signature [(k, v)] -> {k: v}
666
- * @param  array $pairs
667 618
  * @return stdClass
668 619
  */
669 620
 function fromPairs() {
@@ -689,8 +640,6 @@  discard block
 block discarded – undo
689 640
  *
690 641
  * @signature Number -> [a] -> [[a]]
691 642
  * @signature Number -> String -> [String]
692
- * @param  int $size
693
- * @param  array $list
694 643
  * @return array
695 644
  */
696 645
 function slices() {
@@ -715,8 +664,6 @@  discard block
 block discarded – undo
715 664
  *
716 665
  * @signature a -> [a] -> Boolean
717 666
  * @signature String -> String -> Boolean
718
- * @param  mixed $item
719
- * @param  array|string $list
720 667
  * @return bool
721 668
  */
722 669
 function contains() {
@@ -737,8 +684,6 @@  discard block
 block discarded – undo
737 684
  *
738 685
  * @signature (a -> Boolean) -> [a] -> Maybe(Number)
739 686
  * @signature (v -> Boolean) -> {k: v} -> Maybe(k)
740
- * @param  callable $predicate
741
- * @param  array $list
742 687
  * @return mixed
743 688
  */
744 689
 function findIndex() {
@@ -763,8 +708,6 @@  discard block
 block discarded – undo
763 708
  *
764 709
  * @signature (a -> Boolean) -> [a] -> Maybe(Number)
765 710
  * @signature (v -> Boolean) -> {k: v} -> Maybe(k)
766
- * @param  callable $predicate
767
- * @param  array $list
768 711
  * @return mixed
769 712
  */
770 713
 function findLastIndex() {
@@ -787,8 +730,6 @@  discard block
 block discarded – undo
787 730
  * ```
788 731
  *
789 732
  * @signature (a -> Boolean) -> [a] -> Maybe(a)
790
- * @param  callable $predicate
791
- * @param  array $list
792 733
  * @return mixed
793 734
  */
794 735
 function find() {
@@ -807,8 +748,6 @@  discard block
 block discarded – undo
807 748
  * ```
808 749
  *
809 750
  * @signature (a -> Boolean) -> [a] -> Maybe(a)
810
- * @param  callable $predicate
811
- * @param  array $list
812 751
  * @return mixed
813 752
  */
814 753
 function findLast() {
@@ -834,8 +773,6 @@  discard block
 block discarded – undo
834 773
  * @signature a -> [a] -> Maybe(Number) 
835 774
  * @signature v -> {k: v} -> Maybe(k)
836 775
  * @signature String -> String -> Maybe(Number)
837
- * @param  mixed $item
838
- * @param  array $list
839 776
  * @return int
840 777
  */
841 778
 function indexOf() {
@@ -863,8 +800,6 @@  discard block
 block discarded – undo
863 800
  *
864 801
  * @signature a -> [a] -> Number 
865 802
  * @signature String -> String -> Number
866
- * @param  mixed $item
867
- * @param  array $list
868 803
  * @return int
869 804
  */
870 805
 function lastIndexOf() {
@@ -888,8 +823,6 @@  discard block
 block discarded – undo
888 823
  * ```
889 824
  *
890 825
  * @signature (a -> a -> Boolean) -> [a] -> [a]
891
- * @param  callable $areEqual
892
- * @param  array $list
893 826
  * @return array
894 827
  */
895 828
 function uniqueBy() {
@@ -917,7 +850,6 @@  discard block
 block discarded – undo
917 850
  * ```
918 851
  *
919 852
  * @signature [a] -> [a]
920
- * @param  array $list
921 853
  * @return array
922 854
  */
923 855
 function unique() {
@@ -951,8 +883,6 @@  discard block
 block discarded – undo
951 883
  * ```
952 884
  *
953 885
  * @signature (a -> String) -> [a] -> {String: a}
954
- * @param  callable $fn
955
- * @param  array $list
956 886
  * @return array
957 887
  */
958 888
 function groupBy() {
Please login to merge, or discard this patch.
Spacing   +17 added lines, -18 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
  * @return array
57 57
  */
58 58
 function filter() {
59
-    $filter = function($fn, $list){
59
+    $filter = function($fn, $list) {
60 60
         return array_values(array_filter($list, $fn));
61 61
     };
62 62
     return apply(curry($filter), func_get_args());
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
  * @return array
79 79
  */
80 80
 function reduce() {
81
-    $reduce = function($fn, $initial, $list){
81
+    $reduce = function($fn, $initial, $list) {
82 82
         return array_reduce($list, $fn, $initial);
83 83
     };
84 84
     return apply(curry($reduce), func_get_args());
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
  * @return array
105 105
  */
106 106
 function each() {
107
-    $each = function($fn, $list){
107
+    $each = function($fn, $list) {
108 108
         foreach ($list as $item) {
109 109
             apply($fn, [$item]);
110 110
         }
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
  * @return mixed
129 129
  */
130 130
 function head($list) {
131
-    if(is_string($list))
131
+    if (is_string($list))
132 132
         return substr($list, 0, 1);
133 133
     return (count($list) > 0)
134 134
         ? $list[0]
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
  * @return mixed
151 151
  */
152 152
 function last($list) {
153
-    if(is_string($list))
153
+    if (is_string($list))
154 154
         return substr($list, -1);
155 155
     return (count($list) > 0)
156 156
         ? $list[count($list) - 1]
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
  * @return array
174 174
  */
175 175
 function init($list) {
176
-    if(is_string($list))
176
+    if (is_string($list))
177 177
         return (strlen($list) > 1)
178 178
             ? substr($list, 0, strlen($list) - 1)
179 179
             : '';
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
  * @return array
199 199
  */
200 200
 function tail($list) {
201
-    if(is_string($list))
201
+    if (is_string($list))
202 202
         return (strlen($list) > 1)
203 203
             ? substr($list, 1)
204 204
             : '';
@@ -322,8 +322,7 @@  discard block
 block discarded – undo
322 322
  */
323 323
 function concatAll() {
324 324
     $concatAll = function($lists) {
325
-        return length($lists) == 0 ? [] :
326
-            reduce(concat(), head($lists), tail($lists));
325
+        return length($lists) == 0 ? [] : reduce(concat(), head($lists), tail($lists));
327 326
     };
328 327
     return apply(curry($concatAll), func_get_args());
329 328
 }
@@ -402,7 +401,7 @@  discard block
 block discarded – undo
402 401
  * @return array
403 402
  */
404 403
 function append() {
405
-    $append = function ($item, $list) {
404
+    $append = function($item, $list) {
406 405
         return insert(length($list), $item, $list);
407 406
     };
408 407
     return apply(curry($append), func_get_args());
@@ -449,7 +448,7 @@  discard block
 block discarded – undo
449 448
         $length = length($list);
450 449
         if ($count > $length || $count < -$length)
451 450
             return [];
452
-        if(is_string($list)) {
451
+        if (is_string($list)) {
453 452
             return ($count >= 0)
454 453
                 ? substr($list, 0, $count)
455 454
                 : substr($list, $count);
@@ -705,9 +704,9 @@  discard block
 block discarded – undo
705 704
  */
706 705
 function slices() {
707 706
     $slices = function($size, $list) {
708
-        if(empty($list))
707
+        if (empty($list))
709 708
             return is_string($list) ? '' : [];
710
-        if(length($list) <= $size)
709
+        if (length($list) <= $size)
711 710
             return [$list];
712 711
         return prepend(take($size, $list), slices($size, remove($size, $list)));
713 712
     };
@@ -731,7 +730,7 @@  discard block
 block discarded – undo
731 730
  */
732 731
 function contains() {
733 732
     $contains = function($item, $list) {
734
-        return -1 != indexOf($item, $list);
733
+        return - 1 != indexOf($item, $list);
735 734
     };
736 735
     return apply(curry($contains), func_get_args());
737 736
 }
@@ -780,7 +779,7 @@  discard block
 block discarded – undo
780 779
 function findLastIndex() {
781 780
     $findLastIndex = function($predicate, $list) {
782 781
         foreach (reverse(toPairs($list)) as $pair) {
783
-            if($predicate($pair[1]))
782
+            if ($predicate($pair[1]))
784 783
                 return $pair[0];
785 784
         }
786 785
         return null;
@@ -857,7 +856,7 @@  discard block
 block discarded – undo
857 856
             $index = findIndex(equals($item), $list);
858 857
         }
859 858
         return (false === $index || null === $index)
860
-            ? -1
859
+            ? - 1
861 860
             : $index;
862 861
     };
863 862
     return apply(curry($indexOf), func_get_args());
@@ -887,7 +886,7 @@  discard block
 block discarded – undo
887 886
             $index = findLastIndex(equals($item), $list);
888 887
         }
889 888
         return (false === $index || null === $index)
890
-            ? -1
889
+            ? - 1
891 890
             : $index;
892 891
     };
893 892
     return apply(curry($lastIndexOf), func_get_args());
@@ -972,7 +971,7 @@  discard block
 block discarded – undo
972 971
     $groupBy = function($fn, $list) {
973 972
         return reduce(function($result, $item) use($fn) {
974 973
             $index = $fn($item);
975
-            if (! isset($result[$index]))
974
+            if (!isset($result[$index]))
976 975
                 $result[$index] = [];
977 976
             $result[$index][] = $item;
978 977
             return $result;
Please login to merge, or discard this patch.
Braces   +42 added lines, -28 removed lines patch added patch discarded remove patch
@@ -128,8 +128,9 @@  discard block
 block discarded – undo
128 128
  * @return mixed
129 129
  */
130 130
 function head($list) {
131
-    if(is_string($list))
132
-        return substr($list, 0, 1);
131
+    if(is_string($list)) {
132
+            return substr($list, 0, 1);
133
+    }
133 134
     return (count($list) > 0)
134 135
         ? $list[0]
135 136
         : null;
@@ -150,8 +151,9 @@  discard block
 block discarded – undo
150 151
  * @return mixed
151 152
  */
152 153
 function last($list) {
153
-    if(is_string($list))
154
-        return substr($list, -1);
154
+    if(is_string($list)) {
155
+            return substr($list, -1);
156
+    }
155 157
     return (count($list) > 0)
156 158
         ? $list[count($list) - 1]
157 159
         : null;
@@ -173,10 +175,11 @@  discard block
 block discarded – undo
173 175
  * @return array
174 176
  */
175 177
 function init($list) {
176
-    if(is_string($list))
177
-        return (strlen($list) > 1)
178
+    if(is_string($list)) {
179
+            return (strlen($list) > 1)
178 180
             ? substr($list, 0, strlen($list) - 1)
179 181
             : '';
182
+    }
180 183
     return (count($list) > 1)
181 184
         ? array_slice($list, 0, count($list) - 1)
182 185
         : [];
@@ -198,10 +201,11 @@  discard block
 block discarded – undo
198 201
  * @return array
199 202
  */
200 203
 function tail($list) {
201
-    if(is_string($list))
202
-        return (strlen($list) > 1)
204
+    if(is_string($list)) {
205
+            return (strlen($list) > 1)
203 206
             ? substr($list, 1)
204 207
             : '';
208
+    }
205 209
     return (count($list) > 1)
206 210
         ? array_slice($list, 1)
207 211
         : [];
@@ -302,8 +306,9 @@  discard block
 block discarded – undo
302 306
         $t1 = toString($list1);
303 307
         $t2 = toString($list2);
304 308
         // echo "Concating {$t1} and {$t2}", PHP_EOL;
305
-        if (is_string($list1) && is_string($list2))
306
-            return $list1 . $list2;
309
+        if (is_string($list1) && is_string($list2)) {
310
+                    return $list1 . $list2;
311
+        }
307 312
         return array_merge($list1, $list2);
308 313
     };
309 314
     return apply(curry($concat), func_get_args());
@@ -377,10 +382,12 @@  discard block
 block discarded – undo
377 382
 function insertAll() {
378 383
     $insertAll = function($position, $items, $list) {
379 384
         $length = length($list);
380
-        if ($position < 0)
381
-            $position = $length + $position;
382
-        if ($position < 0)
383
-            $position = 0;
385
+        if ($position < 0) {
386
+                    $position = $length + $position;
387
+        }
388
+        if ($position < 0) {
389
+                    $position = 0;
390
+        }
384 391
         return ($position >= $length)
385 392
             ? concat($list, $items)
386 393
             : concatAll([take($position, $list), $items, remove($position, $list)]);
@@ -447,8 +454,9 @@  discard block
 block discarded – undo
447 454
 function take() {
448 455
     $take = function($count, $list) {
449 456
         $length = length($list);
450
-        if ($count > $length || $count < -$length)
451
-            return [];
457
+        if ($count > $length || $count < -$length) {
458
+                    return [];
459
+        }
452 460
         if(is_string($list)) {
453 461
             return ($count >= 0)
454 462
                 ? substr($list, 0, $count)
@@ -573,8 +581,9 @@  discard block
 block discarded – undo
573 581
 function remove() {
574 582
     $remove = function($count, $list) {
575 583
         $length = length($list);
576
-        if ($count > $length || $count < -$length)
577
-            return [];
584
+        if ($count > $length || $count < -$length) {
585
+                    return [];
586
+        }
578 587
         return ($count > 0)
579 588
             ? take($count - $length, $list)
580 589
             : take($count + $length, $list);
@@ -705,10 +714,12 @@  discard block
 block discarded – undo
705 714
  */
706 715
 function slices() {
707 716
     $slices = function($size, $list) {
708
-        if(empty($list))
709
-            return is_string($list) ? '' : [];
710
-        if(length($list) <= $size)
711
-            return [$list];
717
+        if(empty($list)) {
718
+                    return is_string($list) ? '' : [];
719
+        }
720
+        if(length($list) <= $size) {
721
+                    return [$list];
722
+        }
712 723
         return prepend(take($size, $list), slices($size, remove($size, $list)));
713 724
     };
714 725
     return apply(curry($slices), func_get_args());
@@ -754,8 +765,9 @@  discard block
 block discarded – undo
754 765
 function findIndex() {
755 766
     $findIndex = function($predicate, $list) {
756 767
         foreach ($list as $key => $value) {
757
-            if ($predicate($value))
758
-                return $key;
768
+            if ($predicate($value)) {
769
+                            return $key;
770
+            }
759 771
         }
760 772
         return null;
761 773
     };
@@ -780,8 +792,9 @@  discard block
 block discarded – undo
780 792
 function findLastIndex() {
781 793
     $findLastIndex = function($predicate, $list) {
782 794
         foreach (reverse(toPairs($list)) as $pair) {
783
-            if($predicate($pair[1]))
784
-                return $pair[0];
795
+            if($predicate($pair[1])) {
796
+                            return $pair[0];
797
+            }
785 798
         }
786 799
         return null;
787 800
     };
@@ -972,8 +985,9 @@  discard block
 block discarded – undo
972 985
     $groupBy = function($fn, $list) {
973 986
         return reduce(function($result, $item) use($fn) {
974 987
             $index = $fn($item);
975
-            if (! isset($result[$index]))
976
-                $result[$index] = [];
988
+            if (! isset($result[$index])) {
989
+                            $result[$index] = [];
990
+            }
977 991
             $result[$index][] = $item;
978 992
             return $result;
979 993
         }, [], $list);
Please login to merge, or discard this patch.
src/object.php 3 patches
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -32,8 +32,9 @@
 block discarded – undo
32 32
  */
33 33
 function attributes() {
34 34
     $attrs = function($object) {
35
-        if (is_object($object))
36
-            return get_object_vars($object);
35
+        if (is_object($object)) {
36
+                    return get_object_vars($object);
37
+        }
37 38
         return $object;
38 39
     };
39 40
     return apply(curry($attrs), func_get_args());
Please login to merge, or discard this patch.
Doc Comments   -14 removed lines patch added patch discarded remove patch
@@ -19,7 +19,6 @@  discard block
 block discarded – undo
19 19
  * ```
20 20
  *
21 21
  * @signature a -> a
22
- * @param  mixed $value
23 22
  * @return mixed
24 23
  */
25 24
 function clone_() {
@@ -74,7 +73,6 @@  discard block
 block discarded – undo
74 73
  * ```
75 74
  *
76 75
  * @signature {k: v} -> {k: v}
77
- * @param  object $object
78 76
  * @return array
79 77
  */
80 78
 function attributes() {
@@ -150,8 +148,6 @@  discard block
 block discarded – undo
150 148
  * ```
151 149
  *
152 150
  * @signature k -> {k: v} -> Boolean
153
- * @param  string|int $name
154
- * @param  mixed $object
155 151
  * @return bool
156 152
  */
157 153
 function has() {
@@ -180,8 +176,6 @@  discard block
 block discarded – undo
180 176
  * ```
181 177
  *
182 178
  * @signature k -> {k: v} -> Maybe(v)
183
- * @param  string $name
184
- * @param  array $object
185 179
  * @return mixed
186 180
  */
187 181
 function get() {
@@ -208,8 +202,6 @@  discard block
 block discarded – undo
208 202
  * ```
209 203
  *
210 204
  * @signature [k] -> {k: v} -> v
211
- * @param  array $path
212
- * @param  mixed $object
213 205
  * @return mixed
214 206
  */
215 207
 function getPath() {
@@ -232,9 +224,6 @@  discard block
 block discarded – undo
232 224
  * ```
233 225
  *
234 226
  * @signature k -> v -> {k: v} -> {k: v}
235
- * @param  string|int $name
236
- * @param  mixed $value
237
- * @param  mixed $object
238 227
  * @return mixed
239 228
  */
240 229
 function set() {
@@ -257,9 +246,6 @@  discard block
 block discarded – undo
257 246
  * ```
258 247
  *
259 248
  * @signature (a -> Boolean) -> k -> {k : a} -> Boolean
260
- * @param  callable $predicate
261
- * @param  string|int $key
262
- * @param  mixed $object
263 249
  * @return bool
264 250
  */
265 251
 function check() {
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
  * @return bool
156 156
  */
157 157
 function has() {
158
-    $has = function($name, $object){
158
+    $has = function($name, $object) {
159 159
         return contains($name, keys($object));
160 160
     };
161 161
     return apply(curry($has), func_get_args());
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
  * @return mixed
186 186
  */
187 187
 function get() {
188
-    $get = function($name, $object){
188
+    $get = function($name, $object) {
189 189
         $object = attributes($object);
190 190
         return has($name, $object)
191 191
             ? $object[$name]
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
  * @return mixed
214 214
  */
215 215
 function getPath() {
216
-    $getPath = function($path, $object){
216
+    $getPath = function($path, $object) {
217 217
 
218 218
     };
219 219
     return apply(curry($getPath), func_get_args());
Please login to merge, or discard this patch.
src/operators.php 3 patches
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -97,8 +97,9 @@
 block discarded – undo
97 97
 function equals() {
98 98
     $equals = function($a, $b) {
99 99
             $type = type($a);
100
-            if ($type != type($b))
101
-                return false;
100
+            if ($type != type($b)) {
101
+                            return false;
102
+            }
102 103
             switch ($type) {
103 104
                 case 'Null':
104 105
                 case 'Boolean':
Please login to merge, or discard this patch.
Doc Comments   -23 removed lines patch added patch discarded remove patch
@@ -8,8 +8,6 @@  discard block
 block discarded – undo
8 8
  * Returns `$a && $b`.
9 9
  *
10 10
  * @signature Boolean -> Boolean -> Boolean
11
- * @param  bool $a
12
- * @param  bool $b
13 11
  * @return bool
14 12
  */
15 13
 function and_() {
@@ -22,8 +20,6 @@  discard block
 block discarded – undo
22 20
  * Returns `$a || $b`.
23 21
  *
24 22
  * @signature Boolean -> Boolean -> Boolean
25
- * @param  bool $a
26
- * @param  bool $b
27 23
  * @return bool
28 24
  */
29 25
 function or_() {
@@ -36,7 +32,6 @@  discard block
 block discarded – undo
36 32
  * Returns `!$x`.
37 33
  *
38 34
  * @signature Boolean -> Boolean
39
- * @param  bool $x
40 35
  * @return bool
41 36
  */
42 37
 function not() {
@@ -50,8 +45,6 @@  discard block
 block discarded – undo
50 45
  * Returns `$x == $y`.
51 46
  *
52 47
  * @signature * -> * -> Boolean
53
- * @param  mixed $a
54
- * @param  mixed $b
55 48
  * @return bool
56 49
  */
57 50
 function eq() {
@@ -64,8 +57,6 @@  discard block
 block discarded – undo
64 57
  * Returns `$x != $y`.
65 58
  *
66 59
  * @signature * -> * -> Boolean
67
- * @param  mixed $a
68
- * @param  mixed $b
69 60
  * @return bool
70 61
  */
71 62
 function notEq() {
@@ -78,8 +69,6 @@  discard block
 block discarded – undo
78 69
  * Returns `$x === $y`.
79 70
  *
80 71
  * @signature * -> * -> Boolean
81
- * @param  mixed $a
82
- * @param  mixed $b
83 72
  * @return bool
84 73
  */
85 74
 function eqq() {
@@ -92,8 +81,6 @@  discard block
 block discarded – undo
92 81
  * Returns `$x !== $y`.
93 82
  *
94 83
  * @signature * -> * -> Boolean
95
- * @param  mixed $a
96
- * @param  mixed $b
97 84
  * @return bool
98 85
  */
99 86
 function notEqq() {
@@ -118,8 +105,6 @@  discard block
 block discarded – undo
118 105
  * ```
119 106
  *
120 107
  * @signature * -> * -> Boolean
121
- * @param  mixed $a
122
- * @param  mixed $b
123 108
  * @return bool
124 109
  */
125 110
 function equals() {
@@ -157,8 +142,6 @@  discard block
 block discarded – undo
157 142
  * Returns `$a < $b`.
158 143
  *
159 144
  * @signature * -> * -> Boolean
160
- * @param  mixed $a
161
- * @param  mixed $b
162 145
  * @return bool
163 146
  */
164 147
 function lt() {
@@ -171,8 +154,6 @@  discard block
 block discarded – undo
171 154
  * Returns `$a <= $b`.
172 155
  *
173 156
  * @signature * -> * -> Boolean
174
- * @param  mixed $a
175
- * @param  mixed $b
176 157
  * @return bool
177 158
  */
178 159
 function lte() {
@@ -185,8 +166,6 @@  discard block
 block discarded – undo
185 166
  * Returns `$a > $b`.
186 167
  *
187 168
  * @signature * -> * -> Boolean
188
- * @param  mixed $a
189
- * @param  mixed $b
190 169
  * @return bool
191 170
  */
192 171
 function gt() {
@@ -199,8 +178,6 @@  discard block
 block discarded – undo
199 178
  * Returns `$a >= $b`.
200 179
  *
201 180
  * @signature * -> * -> Boolean
202
- * @param  mixed $a
203
- * @param  mixed $b
204 181
  * @return bool
205 182
  */
206 183
 function gte() {
Please login to merge, or discard this patch.
Spacing   +11 added lines, -13 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
  * @return bool
14 14
  */
15 15
 function and_() {
16
-    return apply(curry(function($a, $b){
16
+    return apply(curry(function($a, $b) {
17 17
         return $a && $b;
18 18
     }), func_get_args());
19 19
 }
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
  * @return bool
28 28
  */
29 29
 function or_() {
30
-    return apply(curry(function($a, $b){
30
+    return apply(curry(function($a, $b) {
31 31
         return $a || $b;
32 32
     }), func_get_args());
33 33
 }
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
  * @return bool
56 56
  */
57 57
 function eq() {
58
-    return apply(curry(function($a, $b){
58
+    return apply(curry(function($a, $b) {
59 59
         return $a == $b;
60 60
     }), func_get_args());
61 61
 }
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
  * @return bool
70 70
  */
71 71
 function notEq() {
72
-    return apply(curry(function($a, $b){
72
+    return apply(curry(function($a, $b) {
73 73
         return $a != $b;
74 74
     }), func_get_args());
75 75
 }
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
  * @return bool
84 84
  */
85 85
 function eqq() {
86
-    return apply(curry(function($a, $b){
86
+    return apply(curry(function($a, $b) {
87 87
         return $a === $b;
88 88
     }), func_get_args());
89 89
 }
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
  * @return bool
98 98
  */
99 99
 function notEqq() {
100
-    return apply(curry(function($a, $b){
100
+    return apply(curry(function($a, $b) {
101 101
         return $a !== $b;
102 102
     }), func_get_args());
103 103
 }
@@ -140,9 +140,7 @@  discard block
 block discarded – undo
140 140
                     return $a == $b;
141 141
                 case 'List':
142 142
                     $length = length($a);
143
-                    return length($b) != $length ? false :
144
-                           0 == $length ? true :
145
-                           equals(head($a), head($b)) && equals(tail($a), tail($b));
143
+                    return length($b) != $length ? false : 0 == $length ? true : equals(head($a), head($b)) && equals(tail($a), tail($b));
146 144
                 case 'Array':
147 145
                 case 'ArrayObject':
148 146
                 case 'Object':
@@ -162,7 +160,7 @@  discard block
 block discarded – undo
162 160
  * @return bool
163 161
  */
164 162
 function lt() {
165
-    return apply(curry(function($a, $b){
163
+    return apply(curry(function($a, $b) {
166 164
         return $a < $b;
167 165
     }), func_get_args());
168 166
 }
@@ -176,7 +174,7 @@  discard block
 block discarded – undo
176 174
  * @return bool
177 175
  */
178 176
 function lte() {
179
-    return apply(curry(function($a, $b){
177
+    return apply(curry(function($a, $b) {
180 178
         return $a <= $b;
181 179
     }), func_get_args());
182 180
 }
@@ -190,7 +188,7 @@  discard block
 block discarded – undo
190 188
  * @return bool
191 189
  */
192 190
 function gt() {
193
-    return apply(curry(function($a, $b){
191
+    return apply(curry(function($a, $b) {
194 192
         return $a > $b;
195 193
     }), func_get_args());
196 194
 }
@@ -204,7 +202,7 @@  discard block
 block discarded – undo
204 202
  * @return bool
205 203
  */
206 204
 function gte() {
207
-    return apply(curry(function($a, $b){
205
+    return apply(curry(function($a, $b) {
208 206
         return $a >= $b;
209 207
     }), func_get_args());
210 208
 }
Please login to merge, or discard this patch.