Completed
Push — master ( 713d54...d55531 )
by Amine
02:08
created
src/functions.php 2 patches
Doc Comments   -2 removed lines patch added patch discarded remove patch
@@ -64,8 +64,6 @@
 block discarded – undo
64 64
  * ```
65 65
  *
66 66
  * @signature (*... -> a) -> [*] -> a
67
- * @param  callable $fn
68
- * @param  array    $args
69 67
  * @return mixed
70 68
  */
71 69
 function apply() {
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -91,8 +91,9 @@
 block discarded – undo
91 91
  */
92 92
 function pipe() {
93 93
     $fns = func_get_args();
94
-    if(count($fns) < 1)
95
-        throw new InvalidArgument("pipe() requires at least one argument");
94
+    if(count($fns) < 1) {
95
+            throw new InvalidArgument("pipe() requires at least one argument");
96
+    }
96 97
     return curry(function () use ($fns) {
97 98
         $result = _apply(array_shift($fns), func_get_args());
98 99
         foreach ($fns as $fn) {
Please login to merge, or discard this patch.
src/math.php 1 patch
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.
src/Stream.php 2 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.
src/string.php 1 patch
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.
src/Error.php 1 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 1 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 1 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 2 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.
Braces   +39 added lines, -26 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
         : [];
@@ -299,8 +303,9 @@  discard block
 block discarded – undo
299 303
  */
300 304
 function concat() {
301 305
     $concat = function($list1, $list2) {
302
-        if (is_string($list1))
303
-            return $list1 . $list2;
306
+        if (is_string($list1)) {
307
+                    return $list1 . $list2;
308
+        }
304 309
         return array_merge($list1, $list2);
305 310
     };
306 311
     return apply(curry($concat), func_get_args());
@@ -372,8 +377,9 @@  discard block
 block discarded – undo
372 377
  */
373 378
 function insertAll() {
374 379
     $insertAll = function($position, $items, $list) {
375
-        if ($position < 0)
376
-            $position = length($list) - $position;
380
+        if ($position < 0) {
381
+                    $position = length($list) - $position;
382
+        }
377 383
         return concatAll([take($position, $list), $items, remove($position, $list)]);
378 384
     };
379 385
     return apply(curry($insertAll), func_get_args());
@@ -437,8 +443,9 @@  discard block
 block discarded – undo
437 443
  */
438 444
 function take() {
439 445
     $take = function($count, $list) {
440
-        if ($count > $length || $count < -$length)
441
-            return [];
446
+        if ($count > $length || $count < -$length) {
447
+                    return [];
448
+        }
442 449
         if(is_string($list)) {
443 450
             return ($count >= 0)
444 451
                 ? substr($list, 0, $count)
@@ -563,8 +570,9 @@  discard block
 block discarded – undo
563 570
 function remove() {
564 571
     $remove = function($count, $list) {
565 572
         $length = length($list);
566
-        if ($count > $length || $count < -$length)
567
-            return [];
573
+        if ($count > $length || $count < -$length) {
574
+                    return [];
575
+        }
568 576
         return ($count > 0) 
569 577
             ? take($count - $length)
570 578
             : take($count + $length);
@@ -695,10 +703,12 @@  discard block
 block discarded – undo
695 703
  */
696 704
 function slices() {
697 705
     $slices = function($size, $list) {
698
-        if(empty($list))
699
-            return is_string($list) ? '' : [];
700
-        if(length($list) <= $size)
701
-            return [$list];
706
+        if(empty($list)) {
707
+                    return is_string($list) ? '' : [];
708
+        }
709
+        if(length($list) <= $size) {
710
+                    return [$list];
711
+        }
702 712
         return prepend(take($size, $list), slices($size, remove($size, $list)));
703 713
     };
704 714
     return apply(curry($slices), func_get_args());
@@ -744,8 +754,9 @@  discard block
 block discarded – undo
744 754
 function findIndex() {
745 755
     $findIndex = function($predicate, $list) {
746 756
         foreach ($list as $key => $value) {
747
-            if ($predicate($value))
748
-                return $key;
757
+            if ($predicate($value)) {
758
+                            return $key;
759
+            }
749 760
         }
750 761
         return null;
751 762
     };
@@ -770,8 +781,9 @@  discard block
 block discarded – undo
770 781
 function findLastIndex() {
771 782
     $findLastIndex = function($predicate, $list) {
772 783
         foreach (reverse(toPairs($list)) as $pair) {
773
-            if($predicate($pair[1]))
774
-                return $pair[0];
784
+            if($predicate($pair[1])) {
785
+                            return $pair[0];
786
+            }
775 787
         }
776 788
         return null;
777 789
     };
@@ -959,8 +971,9 @@  discard block
 block discarded – undo
959 971
     $groupBy = function($fn, $list) {
960 972
         return reduce(function($result, $item) use($fn) {
961 973
             $index = $fn($item);
962
-            if (! isset($result[$index]))
963
-                $result[$index] = [];
974
+            if (! isset($result[$index])) {
975
+                            $result[$index] = [];
976
+            }
964 977
             $result[$index][] = $item;
965 978
             return $result;
966 979
         }, [], $list);
Please login to merge, or discard this patch.
src/object.php 2 patches
Doc Comments   -5 removed lines patch added patch discarded remove patch
@@ -27,7 +27,6 @@  discard block
 block discarded – undo
27 27
  * ```
28 28
  *
29 29
  * @signature {k: v} -> {k: v}
30
- * @param  object $object
31 30
  * @return array
32 31
  */
33 32
 function attributes() {
@@ -95,8 +94,6 @@  discard block
 block discarded – undo
95 94
  * ```
96 95
  *
97 96
  * @signature String|Number -> [key => *] -> Boolean
98
- * @param  string $name
99
- * @param  array $object
100 97
  * @return mixed
101 98
  */
102 99
 function has() {
@@ -125,8 +122,6 @@  discard block
 block discarded – undo
125 122
  * ```
126 123
  *
127 124
  * @signature k -> {k: v} -> Maybe(v)
128
- * @param  string $name
129
- * @param  array $object
130 125
  * @return mixed
131 126
  */
132 127
 function get() {
Please login to merge, or discard this patch.
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.