Completed
Push — master ( d1fe82...d3deac )
by Amine
11s
created
performance/run.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@  discard block
 block discarded – undo
3 3
 /**
4 4
  * Returns the list of scripts to compare.
5 5
  *
6
- * @return array
6
+ * @return string[]
7 7
  */
8 8
 function scripts() {
9 9
     return [
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
  * and returns its running time in miliseconds.
102 102
  *
103 103
  * @param  string $path
104
- * @return array
104
+ * @return double
105 105
  */
106 106
 function execute($path, $input) {
107 107
     $start = microtime(true);
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -79,8 +79,8 @@
 block discarded – undo
79 79
  */
80 80
 function averageTime($n, $path, $test) {
81 81
     $s = 0;
82
-    for ($i=0; $i < $n; $i++) {
83
-        $s =+ execute($path, $test->input);
82
+    for ($i = 0; $i < $n; $i ++) {
83
+        $s = + execute($path, $test->input);
84 84
     }
85 85
     return $s / $n;
86 86
 }
Please login to merge, or discard this patch.
src/functions.php 3 patches
Doc Comments   -8 removed lines patch added patch discarded remove patch
@@ -72,8 +72,6 @@  discard block
 block discarded – undo
72 72
  * ```
73 73
  *
74 74
  * @signature (*... -> a) -> [*] -> a
75
- * @param  callable $fn
76
- * @param  array    $args
77 75
  * @return mixed
78 76
  */
79 77
 function apply() {
@@ -97,7 +95,6 @@  discard block
 block discarded – undo
97 95
  * ```
98 96
  *
99 97
  * @signature (((a, b, ...) -> o), (o -> p), ..., (y -> z)) -> ((a, b, ...) -> z)
100
- * @param  callable $fns...
101 98
  * @return callable
102 99
  */
103 100
 function pipe() {
@@ -145,7 +142,6 @@  discard block
 block discarded – undo
145 142
  * ```
146 143
  *
147 144
  * @signature a -> (* -> a)
148
- * @param  mixed $value
149 145
  * @return callable
150 146
  */
151 147
 function give() {
@@ -174,7 +170,6 @@  discard block
 block discarded – undo
174 170
  * ```
175 171
  *
176 172
  * @signature ((a -> Boolean), ..., (a -> Boolean)) -> (a -> Boolean)
177
- * @param  callable $predicates...
178 173
  * @return callable
179 174
  */
180 175
 function all() {
@@ -208,7 +203,6 @@  discard block
 block discarded – undo
208 203
  * ```
209 204
  *
210 205
  * @signature ((a -> Boolean), ..., (a -> Boolean)) -> (a -> Boolean)
211
- * @param  callable $predicates...
212 206
  * @return callable
213 207
  */
214 208
 function any() {
@@ -239,7 +233,6 @@  discard block
 block discarded – undo
239 233
  * ```
240 234
  *
241 235
  * @signature (* -> ... -> *) -> (* -> ... -> Boolean)
242
- * @param  callable $fn
243 236
  * @return callable
244 237
  */
245 238
 function complement() {
@@ -272,7 +265,6 @@  discard block
 block discarded – undo
272 265
  * ```
273 266
  *
274 267
  * @signature (a -> a -> Boolean) -> (a -> a -> Number)
275
- * @param  callable $fn
276 268
  * @return callable
277 269
  */
278 270
 function comparator() {
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
  */
34 34
 function curry($fn) {
35 35
     $n = _number_of_args($fn);
36
-    switch($n) {
36
+    switch ($n) {
37 37
         case 0: return $fn;
38 38
         case 1: return _curry_one($fn);
39 39
         case 2: return _curry_two($fn);
@@ -102,9 +102,9 @@  discard block
 block discarded – undo
102 102
  */
103 103
 function pipe() {
104 104
     $fns = func_get_args();
105
-    if(count($fns) < 1)
105
+    if (count($fns) < 1)
106 106
         return identity();
107
-    return function () use ($fns) {
107
+    return function() use ($fns) {
108 108
         $result = _apply(array_shift($fns), func_get_args());
109 109
         foreach ($fns as $fn) {
110 110
             $result = $fn($result);
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
     $predicates = func_get_args();
182 182
     return _curry_one(function($value) use(&$predicates) {
183 183
         foreach ($predicates as $predicate) {
184
-            if (! $predicate($value))
184
+            if (!$predicate($value))
185 185
                 return false;
186 186
         }
187 187
         return true;
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
     static $comparator = false;
280 280
     $comparator = $comparator ?: curry(function($fn) {
281 281
         return function($a, $b) use($fn) {
282
-            if ($fn($a, $b)) return -1;
282
+            if ($fn($a, $b)) return - 1;
283 283
             if ($fn($b, $a)) return 1;
284 284
             return 0;
285 285
         };
Please login to merge, or discard this patch.
Braces   +15 added lines, -8 removed lines patch added patch discarded remove patch
@@ -102,8 +102,9 @@  discard block
 block discarded – undo
102 102
  */
103 103
 function pipe() {
104 104
     $fns = func_get_args();
105
-    if(count($fns) < 1)
106
-        return identity();
105
+    if(count($fns) < 1) {
106
+            return identity();
107
+    }
107 108
     return function () use ($fns) {
108 109
         $result = _apply(array_shift($fns), func_get_args());
109 110
         foreach ($fns as $fn) {
@@ -181,8 +182,9 @@  discard block
 block discarded – undo
181 182
     $predicates = func_get_args();
182 183
     return _curry_one(function($value) use(&$predicates) {
183 184
         foreach ($predicates as $predicate) {
184
-            if (! $predicate($value))
185
-                return false;
185
+            if (! $predicate($value)) {
186
+                            return false;
187
+            }
186 188
         }
187 189
         return true;
188 190
     });
@@ -215,8 +217,9 @@  discard block
 block discarded – undo
215 217
     $predicates = func_get_args();
216 218
     return _curry_one(function($value) use(&$predicates) {
217 219
         foreach ($predicates as $predicate) {
218
-            if ($predicate($value))
219
-                return true;
220
+            if ($predicate($value)) {
221
+                            return true;
222
+            }
220 223
         }
221 224
         return false;
222 225
     });
@@ -279,8 +282,12 @@  discard block
 block discarded – undo
279 282
     static $comparator = false;
280 283
     $comparator = $comparator ?: curry(function($fn) {
281 284
         return function($a, $b) use($fn) {
282
-            if ($fn($a, $b)) return -1;
283
-            if ($fn($b, $a)) return 1;
285
+            if ($fn($a, $b)) {
286
+                return -1;
287
+            }
288
+            if ($fn($b, $a)) {
289
+                return 1;
290
+            }
284 291
             return 0;
285 292
         };
286 293
     });
Please login to merge, or discard this patch.
build.php 1 patch
Braces   +55 added lines, -37 removed lines patch added patch discarded remove patch
@@ -148,14 +148,16 @@  discard block
 block discarded – undo
148 148
 function write_module($module) {
149 149
     if ($module->docs) {
150 150
         $docsDir  = dirname($module->docsPath);
151
-        if (!is_dir($docsDir))
152
-            mkdir($docsDir, 0777, true);
151
+        if (!is_dir($docsDir)) {
152
+                    mkdir($docsDir, 0777, true);
153
+        }
153 154
         file_put_contents($module->docsPath,  $module->docs);
154 155
     }
155 156
     if ($module->tests) {
156 157
         $testsDir = dirname($module->testsPath);
157
-        if (!is_dir($testsDir))
158
-            mkdir($testsDir, 0777, true);
158
+        if (!is_dir($testsDir)) {
159
+                    mkdir($testsDir, 0777, true);
160
+        }
159 161
         file_put_contents($module->testsPath, $module->tests);
160 162
     }
161 163
     if ($module->streamOperations) {
@@ -252,9 +254,15 @@  discard block
 block discarded – undo
252 254
     $tags = groupBy(get('name'), tags_of($doxBlock));
253 255
 
254 256
     $type = 'function';
255
-    if (has('file', $tags)) $type = 'file';
256
-    if (has('class', $tags)) $type = 'class';
257
-    if (has('method', $tags)) $type = 'method';
257
+    if (has('file', $tags)) {
258
+        $type = 'file';
259
+    }
260
+    if (has('class', $tags)) {
261
+        $type = 'class';
262
+    }
263
+    if (has('method', $tags)) {
264
+        $type = 'method';
265
+    }
258 266
 
259 267
     $params = map(function($tag){
260 268
         $parts = split(' ', get('value', $tag));
@@ -266,8 +274,9 @@  discard block
 block discarded – undo
266 274
 
267 275
     $return = getPath(['return', 0, 'value'], $tags);
268 276
     $signatures = get('signature', $tags);
269
-    if ($signatures)
270
-        $signatures = map(get('value'), $signatures);
277
+    if ($signatures) {
278
+            $signatures = map(get('value'), $signatures);
279
+    }
271 280
     return (object) [
272 281
         'type' => $type,
273 282
         'name' => getPath(['ctx', 'name'], $doxBlock),
@@ -291,12 +300,13 @@  discard block
 block discarded – undo
291 300
  * @return array
292 301
  */
293 302
 function tags_of($doxBlock) {
294
-    if ($doxBlock->tags)
295
-        return map(function($tag){
303
+    if ($doxBlock->tags) {
304
+            return map(function($tag){
296 305
             return (object) [
297 306
                 'name'  => $tag->type,
298 307
                 'value' => $tag->string
299 308
             ];
309
+    }
300 310
         }, $doxBlock->tags);
301 311
     return [];
302 312
 }
@@ -310,8 +320,9 @@  discard block
 block discarded – undo
310 320
  */
311 321
 function generate_docs($module) {
312 322
     $module->docs = '';
313
-    if (startsWith('_', $module->name))
314
-        return $module;
323
+    if (startsWith('_', $module->name)) {
324
+            return $module;
325
+    }
315 326
     return apply(process_of([
316 327
         'generate_docs_header',
317 328
         'generate_docs_sommaire',
@@ -388,15 +399,17 @@  discard block
 block discarded – undo
388 399
  * @return string
389 400
  */
390 401
 function generate_docs_contents_item($block) {
391
-    if ($block->type != 'function')
392
-        return '';
402
+    if ($block->type != 'function') {
403
+            return '';
404
+    }
393 405
     $params = join(', ', map(pipe(values(), join(' ')), get('params', $block)));
394 406
     $return = get('return', $block);
395 407
     $prototype = "```php\n{$block->name}({$params}) : {$return}\n```\n\n";
396 408
     $signature = '';
397 409
     $blockSignature = join("\n", $block->signatures);
398
-    if ($blockSignature)
399
-        $signature = "```\n{$blockSignature}\n```\n\n";
410
+    if ($blockSignature) {
411
+            $signature = "```\n{$blockSignature}\n```\n\n";
412
+    }
400 413
     return "# {$block->name}\n\n{$prototype}{$signature}{$block->description}\n\n";
401 414
 }
402 415
 
@@ -427,8 +440,9 @@  discard block
 block discarded – undo
427 440
 function generate_tests_header($module) {
428 441
     $namespace = "Tarsana\UnitTests\Functional";
429 442
     $additionalNamespace = replace("/", "\\", remove(6, dirname($module->testsPath)));
430
-    if ($additionalNamespace)
431
-        $namespace .= "\\" . $additionalNamespace;
443
+    if ($additionalNamespace) {
444
+            $namespace .= "\\" . $additionalNamespace;
445
+    }
432 446
     $name = remove(-4, last(split("/", $module->testsPath)));
433 447
     $module->tests .= "<?php namespace {$namespace};\n\nuse Tarsana\Functional as F;\n\nclass {$name} extends \Tarsana\UnitTests\Functional\UnitTest {\n";
434 448
     return $module;
@@ -449,10 +463,11 @@  discard block
 block discarded – undo
449 463
     $contents = join("\n", map(function($block) use($module) {
450 464
         return generate_tests_contents_item($block, $module);
451 465
     }, $blocks));
452
-    if (trim($contents) != '')
453
-        $module->tests .= $contents;
454
-    else
455
-        $module->tests = '';
466
+    if (trim($contents) != '') {
467
+            $module->tests .= $contents;
468
+    } else {
469
+            $module->tests = '';
470
+    }
456 471
     return $module;
457 472
 }
458 473
 
@@ -465,8 +480,9 @@  discard block
 block discarded – undo
465 480
  * @return string
466 481
  */
467 482
 function generate_tests_contents_item($block, $module) {
468
-    if ($block->type != 'function')
469
-        return '';
483
+    if ($block->type != 'function') {
484
+            return '';
485
+    }
470 486
 
471 487
     $code = apply(pipe(
472 488
         _f('code_from_description'),
@@ -480,8 +496,9 @@  discard block
 block discarded – undo
480 496
         join("\n")
481 497
     ), [$block]);
482 498
 
483
-    if ('' == trim($code))
484
-        return '';
499
+    if ('' == trim($code)) {
500
+            return '';
501
+    }
485 502
     return prepend("\tpublic function test_{$block->name}() {\n",
486 503
         append("\n\t}\n", $code)
487 504
     );
@@ -496,8 +513,9 @@  discard block
 block discarded – undo
496 513
  */
497 514
 function code_from_description($block) {
498 515
     $description = get('description', $block);
499
-    if (!contains('```php', $description))
500
-        return '';
516
+    if (!contains('```php', $description)) {
517
+            return '';
518
+    }
501 519
     $code = remove(7 + indexOf('```php', $description), $description);
502 520
     return remove(-4, trim($code));
503 521
 }
@@ -513,8 +531,7 @@  discard block
 block discarded – undo
513 531
     if (contains('; //=> ', $part)) {
514 532
         $pieces = split('; //=> ', $part);
515 533
         $part = "\$this->assertEquals({$pieces[1]}, {$pieces[0]});";
516
-    }
517
-    elseif (contains('; // throws ', $part)) {
534
+    } elseif (contains('; // throws ', $part)) {
518 535
         $pieces = split('; // throws ', $part);
519 536
         $variables = match('/ \$[0-9a-zA-Z_]+/', $pieces[0]);
520 537
         $use = '';
@@ -523,8 +540,7 @@  discard block
 block discarded – undo
523 540
             $use = "use({$variables}) ";
524 541
         }
525 542
         return "\$this->assertErrorThrown(function() {$use}{\n\t$pieces[0]; \n},\n{$pieces[1]});";
526
-    }
527
-    elseif (startsWith('class ', $part) || startsWith('function ', $part)) {
543
+    } elseif (startsWith('class ', $part) || startsWith('function ', $part)) {
528 544
         $module->testsFooter .= $part . "\n\n";
529 545
         $part = '';
530 546
     }
@@ -539,8 +555,9 @@  discard block
 block discarded – undo
539 555
  * @return object
540 556
  */
541 557
 function generate_tests_footer($module) {
542
-    if ($module->tests)
543
-        $module->tests .= "}\n\n{$module->testsFooter}";
558
+    if ($module->tests) {
559
+            $module->tests .= "}\n\n{$module->testsFooter}";
560
+    }
544 561
     return $module;
545 562
 }
546 563
 
@@ -676,8 +693,9 @@  discard block
 block discarded – undo
676 693
 
677 694
 // Convert Warnings to Exceptions
678 695
 set_error_handler(function($errno, $errstr, $errfile, $errline, array $errcontext) {
679
-    if (0 === error_reporting())
680
-        return false;
696
+    if (0 === error_reporting()) {
697
+            return false;
698
+    }
681 699
     throw new \ErrorException($errstr, 0, $errno, $errfile, $errline);
682 700
 });
683 701
 
Please login to merge, or discard this patch.
src/list.php 2 patches
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
  */
100 100
 function reduce() {
101 101
     static $reduce = false;
102
-    $reduce = $reduce ?: curry(function($fn, $initial, $list){
102
+    $reduce = $reduce ?: curry(function($fn, $initial, $list) {
103 103
         return array_reduce($list, $fn, $initial);
104 104
     });
105 105
     return _apply($reduce, func_get_args());
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
  */
127 127
 function each() {
128 128
     static $each = false;
129
-    $each = $each ?: curry(function($fn, $list){
129
+    $each = $each ?: curry(function($fn, $list) {
130 130
         foreach ($list as $item) {
131 131
             $fn($item);
132 132
         }
@@ -176,10 +176,10 @@  discard block
 block discarded – undo
176 176
  * @param  array|string $list
177 177
  * @return mixed
178 178
  */
179
-function last () {
179
+function last() {
180 180
     static $last = false;
181 181
     $last = $last ?: curry(function($list) {
182
-        if(is_string($list))
182
+        if (is_string($list))
183 183
             return substr($list, -1);
184 184
         $size = count($list);
185 185
         return ($size > 0)
@@ -206,10 +206,10 @@  discard block
 block discarded – undo
206 206
  * @param  array|string $list
207 207
  * @return array
208 208
  */
209
-function init () {
209
+function init() {
210 210
     static $init = false;
211 211
     $init = $init ?: curry(function($list) {
212
-        if(is_string($list)) {
212
+        if (is_string($list)) {
213 213
             $size = strlen($list);
214 214
             return ($size > 1)
215 215
                 ? substr($list, 0, $size - 1)
@@ -240,10 +240,10 @@  discard block
 block discarded – undo
240 240
  * @param  array|string $list
241 241
  * @return array
242 242
  */
243
-function tail () {
243
+function tail() {
244 244
     static $tail = false;
245 245
     $tail = $tail ?: curry(function($list) {
246
-        if(is_string($list))
246
+        if (is_string($list))
247 247
             return (strlen($list) > 1)
248 248
                 ? substr($list, 1)
249 249
                 : '';
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
  * @param  array|string $list
269 269
  * @return array
270 270
  */
271
-function reverse () {
271
+function reverse() {
272 272
     static $reverse = false;
273 273
     $reverse = $reverse ?: curry(function($list) {
274 274
         return is_string($list)
@@ -321,7 +321,7 @@  discard block
 block discarded – undo
321 321
     static $allSatisfies = false;
322 322
     $allSatisfies = $allSatisfies ?: curry(function($predicate, $list) {
323 323
         foreach ($list as $item) {
324
-            if (! $predicate($item))
324
+            if (!$predicate($item))
325 325
                 return false;
326 326
         }
327 327
         return true;
@@ -497,7 +497,7 @@  discard block
 block discarded – undo
497 497
  */
498 498
 function append() {
499 499
     static $append = false;
500
-    $append = $append ?: curry(function ($item, $list) {
500
+    $append = $append ?: curry(function($item, $list) {
501 501
         return is_string($list)
502 502
             ? $list . $item
503 503
             : array_merge($list, [$item]);
@@ -523,7 +523,7 @@  discard block
 block discarded – undo
523 523
  */
524 524
 function prepend() {
525 525
     static $prepend = false;
526
-    $prepend = $prepend ?: curry(function ($item, $list) {
526
+    $prepend = $prepend ?: curry(function($item, $list) {
527 527
         return is_string($list)
528 528
             ? $item . $list
529 529
             : array_merge([$item], $list);
@@ -558,7 +558,7 @@  discard block
 block discarded – undo
558 558
         $length = length($list);
559 559
         if ($count > $length || $count < -$length)
560 560
             return $list;
561
-        if(is_string($list)) {
561
+        if (is_string($list)) {
562 562
             return ($count >= 0)
563 563
                 ? substr($list, 0, $count)
564 564
                 : substr($list, $count);
@@ -709,7 +709,7 @@  discard block
 block discarded – undo
709 709
         $count = ($count > 0)
710 710
             ? $count - $length
711 711
             : $count + $length;
712
-        if(is_string($list)) {
712
+        if (is_string($list)) {
713 713
             return ($count >= 0)
714 714
                 ? substr($list, 0, $count)
715 715
                 : substr($list, $count);
@@ -1066,7 +1066,7 @@  discard block
 block discarded – undo
1066 1066
     $indexOf = $indexOf ?: curry(function($item, $list) {
1067 1067
         if (is_string($list)) {
1068 1068
             $index = strpos($list, $item);
1069
-            return $index === false ? -1 : $index;
1069
+            return $index === false ? - 1 : $index;
1070 1070
         }
1071 1071
         $list = (array) $list;
1072 1072
         $index = 0;
@@ -1077,7 +1077,7 @@  discard block
 block discarded – undo
1077 1077
                 return $keys[$index];
1078 1078
             $index ++;
1079 1079
         }
1080
-        return -1;
1080
+        return - 1;
1081 1081
     });
1082 1082
     return _apply($indexOf, func_get_args());
1083 1083
 }
@@ -1106,7 +1106,7 @@  discard block
 block discarded – undo
1106 1106
     $lastIndexOf = $lastIndexOf ?: curry(function($item, $list) {
1107 1107
         if (is_string($list)) {
1108 1108
             $index = strrpos($list, $item);
1109
-            return $index === false ? -1 : $index;
1109
+            return $index === false ? - 1 : $index;
1110 1110
         }
1111 1111
         $list = (array) $list;
1112 1112
         $keys = array_keys($list);
@@ -1116,7 +1116,7 @@  discard block
 block discarded – undo
1116 1116
                 return $keys[$index];
1117 1117
             $index --;
1118 1118
         }
1119
-        return -1;
1119
+        return - 1;
1120 1120
     });
1121 1121
     return _apply($lastIndexOf, func_get_args());
1122 1122
 }
@@ -1151,7 +1151,7 @@  discard block
 block discarded – undo
1151 1151
                 }
1152 1152
                 $index ++;
1153 1153
             }
1154
-            if (! $found) {
1154
+            if (!$found) {
1155 1155
                 $result[$size] = $item;
1156 1156
                 $size ++;
1157 1157
             }
@@ -1211,9 +1211,9 @@  discard block
 block discarded – undo
1211 1211
     static $groupBy = false;
1212 1212
     $groupBy = $groupBy ?: curry(function($fn, $list) {
1213 1213
         $result = [];
1214
-        foreach($list as $item) {
1214
+        foreach ($list as $item) {
1215 1215
             $index = $fn($item);
1216
-            if (! isset($result[$index]))
1216
+            if (!isset($result[$index]))
1217 1217
                 $result[$index] = [];
1218 1218
             $result[$index][] = $item;
1219 1219
         }
Please login to merge, or discard this patch.
Braces   +93 added lines, -61 removed lines patch added patch discarded remove patch
@@ -72,8 +72,9 @@  discard block
 block discarded – undo
72 72
     $filter = $filter ?: curry(function($fn, $list) {
73 73
         $result = [];
74 74
         foreach ($list as $item) {
75
-            if ($fn($item))
76
-                $result[] = $item;
75
+            if ($fn($item)) {
76
+                            $result[] = $item;
77
+            }
77 78
         }
78 79
         return $result;
79 80
     });
@@ -154,7 +155,9 @@  discard block
 block discarded – undo
154 155
 function head() {
155 156
     static $head = false;
156 157
     $head = $head ?: curry(function($list) {
157
-        if (isset($list[0])) return $list[0];
158
+        if (isset($list[0])) {
159
+            return $list[0];
160
+        }
158 161
         return is_string($list) ? '' : null;
159 162
     });
160 163
     return _apply($head, func_get_args());
@@ -179,8 +182,9 @@  discard block
 block discarded – undo
179 182
 function last () {
180 183
     static $last = false;
181 184
     $last = $last ?: curry(function($list) {
182
-        if(is_string($list))
183
-            return substr($list, -1);
185
+        if(is_string($list)) {
186
+                    return substr($list, -1);
187
+        }
184 188
         $size = count($list);
185 189
         return ($size > 0)
186 190
             ? $list[$size - 1]
@@ -243,10 +247,11 @@  discard block
 block discarded – undo
243 247
 function tail () {
244 248
     static $tail = false;
245 249
     $tail = $tail ?: curry(function($list) {
246
-        if(is_string($list))
247
-            return (strlen($list) > 1)
250
+        if(is_string($list)) {
251
+                    return (strlen($list) > 1)
248 252
                 ? substr($list, 1)
249 253
                 : '';
254
+        }
250 255
         return (count($list) > 1)
251 256
             ? array_slice($list, 1)
252 257
             : [];
@@ -321,8 +326,9 @@  discard block
 block discarded – undo
321 326
     static $allSatisfies = false;
322 327
     $allSatisfies = $allSatisfies ?: curry(function($predicate, $list) {
323 328
         foreach ($list as $item) {
324
-            if (! $predicate($item))
325
-                return false;
329
+            if (! $predicate($item)) {
330
+                            return false;
331
+            }
326 332
         }
327 333
         return true;
328 334
     });
@@ -348,8 +354,9 @@  discard block
 block discarded – undo
348 354
     static $anySatisfies = false;
349 355
     $anySatisfies = $anySatisfies ?: curry(function($predicate, $list) {
350 356
         foreach ($list as $item) {
351
-            if ($predicate($item))
352
-                return true;
357
+            if ($predicate($item)) {
358
+                            return true;
359
+            }
353 360
         }
354 361
         return false;
355 362
     });
@@ -374,8 +381,9 @@  discard block
 block discarded – undo
374 381
 function concat() {
375 382
     static $concat = false;
376 383
     $concat = $concat ?: curry(function($list1, $list2) {
377
-        if (is_string($list1) && is_string($list2))
378
-            return $list1 . $list2;
384
+        if (is_string($list1) && is_string($list2)) {
385
+                    return $list1 . $list2;
386
+        }
379 387
         return array_merge($list1, $list2);
380 388
     });
381 389
     return _apply($concat, func_get_args());
@@ -397,10 +405,12 @@  discard block
 block discarded – undo
397 405
 function concatAll() {
398 406
     static $concatAll = false;
399 407
     $concatAll = $concatAll ?: curry(function($lists) {
400
-        if (count($lists) == 0)
401
-            return [];
402
-        if (is_string($lists[0]))
403
-            return implode('', $lists);
408
+        if (count($lists) == 0) {
409
+                    return [];
410
+        }
411
+        if (is_string($lists[0])) {
412
+                    return implode('', $lists);
413
+        }
404 414
         return _apply('array_merge', $lists);
405 415
     });
406 416
     return _apply($concatAll, func_get_args());
@@ -465,14 +475,17 @@  discard block
 block discarded – undo
465 475
     static $insertAll = false;
466 476
     $insertAll = $insertAll ?: curry(function($position, $items, $list) {
467 477
         $size = length($list);
468
-        if ($position < 0)
469
-            $position = $size + $position;
470
-        if ($position < 0)
471
-            $position = 0;
472
-        if (is_string($list))
473
-            return ($position >= $size)
478
+        if ($position < 0) {
479
+                    $position = $size + $position;
480
+        }
481
+        if ($position < 0) {
482
+                    $position = 0;
483
+        }
484
+        if (is_string($list)) {
485
+                    return ($position >= $size)
474 486
                 ? $list . $items
475 487
                 : substr($list, 0, $position) . $items . substr($list, $position);
488
+        }
476 489
         return ($position >= $size)
477 490
             ? array_merge($list, $items)
478 491
             : array_merge(array_slice($list, 0, $position), $items, array_slice($list, $position));
@@ -556,8 +569,9 @@  discard block
 block discarded – undo
556 569
     static $take = false;
557 570
     $take = $take ?: curry(function($count, $list) {
558 571
         $length = length($list);
559
-        if ($count > $length || $count < -$length)
560
-            return $list;
572
+        if ($count > $length || $count < -$length) {
573
+                    return $list;
574
+        }
561 575
         if(is_string($list)) {
562 576
             return ($count >= 0)
563 577
                 ? substr($list, 0, $count)
@@ -591,8 +605,9 @@  discard block
 block discarded – undo
591 605
     $takeWhile = $takeWhile ?: curry(function($predicate, $list) {
592 606
         $index = 0;
593 607
         $size = length($list);
594
-        while ($index < $size && $predicate($list[$index]))
595
-            $index ++;
608
+        while ($index < $size && $predicate($list[$index])) {
609
+                    $index ++;
610
+        }
596 611
         return array_slice($list, 0, $index);
597 612
     });
598 613
     return _apply($takeWhile, func_get_args());
@@ -617,8 +632,9 @@  discard block
 block discarded – undo
617 632
     static $takeLastWhile = false;
618 633
     $takeLastWhile = $takeLastWhile ?: curry(function($predicate, $list) {
619 634
         $index = length($list) - 1;
620
-        while ($index >= 0 && $predicate($list[$index]))
621
-            $index --;
635
+        while ($index >= 0 && $predicate($list[$index])) {
636
+                    $index --;
637
+        }
622 638
         return array_slice($list, $index + 1);
623 639
     });
624 640
     return _apply($takeLastWhile, func_get_args());
@@ -645,8 +661,9 @@  discard block
 block discarded – undo
645 661
     $takeUntil = $takeUntil ?: curry(function($predicate, $list) {
646 662
         $index = 0;
647 663
         $size = length($list);
648
-        while ($index < $size && !$predicate($list[$index]))
649
-            $index ++;
664
+        while ($index < $size && !$predicate($list[$index])) {
665
+                    $index ++;
666
+        }
650 667
         return array_slice($list, 0, $index);
651 668
     });
652 669
     return _apply($takeUntil, func_get_args());
@@ -671,8 +688,9 @@  discard block
 block discarded – undo
671 688
     static $takeLastUntil = false;
672 689
     $takeLastUntil = $takeLastUntil ?: curry(function($predicate, $list) {
673 690
         $index = length($list) - 1;
674
-        while ($index >= 0 && !$predicate($list[$index]))
675
-            $index --;
691
+        while ($index >= 0 && !$predicate($list[$index])) {
692
+                    $index --;
693
+        }
676 694
         return array_slice($list, $index + 1);
677 695
     });
678 696
     return _apply($takeLastUntil, func_get_args());
@@ -704,8 +722,9 @@  discard block
 block discarded – undo
704 722
     $remove = $remove ?: curry(function($count, $list) {
705 723
         // ...
706 724
         $length = length($list);
707
-        if ($count > $length || $count < -$length)
708
-            return [];
725
+        if ($count > $length || $count < -$length) {
726
+                    return [];
727
+        }
709 728
         $count = ($count > 0)
710 729
             ? $count - $length
711 730
             : $count + $length;
@@ -742,8 +761,9 @@  discard block
 block discarded – undo
742 761
     $removeWhile = $removeWhile ?: curry(function($predicate, $list) {
743 762
         $index = 0;
744 763
         $size = length($list);
745
-        while ($index < $size && $predicate($list[$index]))
746
-            $index ++;
764
+        while ($index < $size && $predicate($list[$index])) {
765
+                    $index ++;
766
+        }
747 767
         return array_slice($list, $index);
748 768
     });
749 769
     return _apply($removeWhile, func_get_args());
@@ -768,8 +788,9 @@  discard block
 block discarded – undo
768 788
     static $removeLastWhile = false;
769 789
     $removeLastWhile = $removeLastWhile ?: curry(function($predicate, $list) {
770 790
         $index = length($list) - 1;
771
-        while ($index >= 0 && $predicate($list[$index]))
772
-            $index --;
791
+        while ($index >= 0 && $predicate($list[$index])) {
792
+                    $index --;
793
+        }
773 794
         return array_slice($list, 0, $index + 1);
774 795
     });
775 796
     return _apply($removeLastWhile, func_get_args());
@@ -797,8 +818,9 @@  discard block
 block discarded – undo
797 818
     $removeUntil = $removeUntil ?: curry(function($predicate, $list) {
798 819
         $index = 0;
799 820
         $size = length($list);
800
-        while ($index < $size && !$predicate($list[$index]))
801
-            $index ++;
821
+        while ($index < $size && !$predicate($list[$index])) {
822
+                    $index ++;
823
+        }
802 824
         return array_slice($list, $index);
803 825
     });
804 826
     return _apply($removeUntil, func_get_args());
@@ -824,8 +846,9 @@  discard block
 block discarded – undo
824 846
     static $removeLastUntil = false;
825 847
     $removeLastUntil = $removeLastUntil ?: curry(function($predicate, $list) {
826 848
         $index = length($list) - 1;
827
-        while ($index >= 0 && !$predicate($list[$index]))
828
-            $index --;
849
+        while ($index >= 0 && !$predicate($list[$index])) {
850
+                    $index --;
851
+        }
829 852
         return array_slice($list, 0, $index + 1);
830 853
     });
831 854
     return _apply($removeLastUntil, func_get_args());
@@ -878,8 +901,9 @@  discard block
 block discarded – undo
878 901
     static $slices = false;
879 902
     $slices = $slices ?: curry(function($size, &$list) {
880 903
         $length = length($list);
881
-        if ($length == 0)
882
-            return is_string($list) ? [''] : [];
904
+        if ($length == 0) {
905
+                    return is_string($list) ? [''] : [];
906
+        }
883 907
         $start = 0;
884 908
         $result = [];
885 909
         $slicer = is_string($list) ? 'substr' : 'array_slice';
@@ -940,8 +964,9 @@  discard block
 block discarded – undo
940 964
     static $findIndex = false;
941 965
     $findIndex = $findIndex ?: curry(function($predicate, $list) {
942 966
         foreach ($list as $key => &$value) {
943
-            if ($predicate($value))
944
-                return $key;
967
+            if ($predicate($value)) {
968
+                            return $key;
969
+            }
945 970
         }
946 971
         return null;
947 972
     });
@@ -971,8 +996,9 @@  discard block
 block discarded – undo
971 996
         $keys = array_keys($list);
972 997
         $index = count($keys) - 1;
973 998
         while ($index >= 0) {
974
-            if ($predicate($list[$keys[$index]]))
975
-                return $keys[$index];
999
+            if ($predicate($list[$keys[$index]])) {
1000
+                            return $keys[$index];
1001
+            }
976 1002
             $index --;
977 1003
         }
978 1004
         return null;
@@ -999,8 +1025,9 @@  discard block
 block discarded – undo
999 1025
     static $find = false;
1000 1026
     $find = $find ?: curry(function($predicate, $list) {
1001 1027
         foreach ($list as $key => &$value) {
1002
-            if ($predicate($value))
1003
-                return $value;
1028
+            if ($predicate($value)) {
1029
+                            return $value;
1030
+            }
1004 1031
         }
1005 1032
         return null;
1006 1033
     });
@@ -1028,8 +1055,9 @@  discard block
 block discarded – undo
1028 1055
         $keys = array_keys($list);
1029 1056
         $index = count($keys) - 1;
1030 1057
         while ($index >= 0) {
1031
-            if ($predicate($list[$keys[$index]]))
1032
-                return $list[$keys[$index]];
1058
+            if ($predicate($list[$keys[$index]])) {
1059
+                            return $list[$keys[$index]];
1060
+            }
1033 1061
             $index --;
1034 1062
         }
1035 1063
         return null;
@@ -1073,8 +1101,9 @@  discard block
 block discarded – undo
1073 1101
         $keys = array_keys($list);
1074 1102
         $length = count($keys);
1075 1103
         while ($index < $length) {
1076
-            if (_equals($item, $list[$keys[$index]]))
1077
-                return $keys[$index];
1104
+            if (_equals($item, $list[$keys[$index]])) {
1105
+                            return $keys[$index];
1106
+            }
1078 1107
             $index ++;
1079 1108
         }
1080 1109
         return -1;
@@ -1112,8 +1141,9 @@  discard block
 block discarded – undo
1112 1141
         $keys = array_keys($list);
1113 1142
         $index = count($list) - 1;
1114 1143
         while ($index >= 0) {
1115
-            if (_equals($list[$keys[$index]], $item))
1116
-                return $keys[$index];
1144
+            if (_equals($list[$keys[$index]], $item)) {
1145
+                            return $keys[$index];
1146
+            }
1117 1147
             $index --;
1118 1148
         }
1119 1149
         return -1;
@@ -1213,8 +1243,9 @@  discard block
 block discarded – undo
1213 1243
         $result = [];
1214 1244
         foreach($list as $item) {
1215 1245
             $index = $fn($item);
1216
-            if (! isset($result[$index]))
1217
-                $result[$index] = [];
1246
+            if (! isset($result[$index])) {
1247
+                            $result[$index] = [];
1248
+            }
1218 1249
             $result[$index][] = $item;
1219 1250
         }
1220 1251
         return $result;
@@ -1243,8 +1274,9 @@  discard block
 block discarded – undo
1243 1274
     $pairsFrom = $pairsFrom ?: curry(function($list1, $list2) {
1244 1275
         $length1 = count($list1);
1245 1276
         $length2 = count($list2);
1246
-        if (0 == $length1 || 0 == $length2)
1247
-            return [];
1277
+        if (0 == $length1 || 0 == $length2) {
1278
+                    return [];
1279
+        }
1248 1280
         $result = [];
1249 1281
         $index = 0;
1250 1282
         $length = min($length1, $length2);
Please login to merge, or discard this patch.
src/string.php 3 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -336,10 +336,10 @@
 block discarded – undo
336 336
         // $text = 'foo ("bar baz" alpha) beta'
337 337
         $counters = [
338 338
             'values'   => [], // each item of this array refers to the number
339
-                              // of closings needed for an opening
339
+                                // of closings needed for an opening
340 340
             'openings' => [], // an associative array where the key is an opening
341
-                              // and the value is the index of corresponding cell
342
-                              // in the 'values' field
341
+                                // and the value is the index of corresponding cell
342
+                                // in the 'values' field
343 343
             'closings' => [], // associative array for closings like the previous one
344 344
             'total'    => 0   // the total number of needed closings
345 345
         ];
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@
 block discarded – undo
46 46
  */
47 47
 function join() {
48 48
     static $join = false;
49
-    $join = $join ?: curry(function($glue, $pieces){
49
+    $join = $join ?: curry(function($glue, $pieces) {
50 50
         return implode($glue, $pieces);
51 51
     });
52 52
     return _apply($join, func_get_args());
Please login to merge, or discard this patch.
Braces   +8 added lines, -6 removed lines patch added patch discarded remove patch
@@ -345,10 +345,11 @@  discard block
 block discarded – undo
345 345
         ];
346 346
         foreach (str_split($surrounders) as $key => $char) {
347 347
             $counters['values'][$key / 2] = 0;
348
-            if ($key % 2 == 0)
349
-                $counters['openings'][$char] = $key / 2;
350
-            else
351
-                $counters['closings'][$char] = $key / 2;
348
+            if ($key % 2 == 0) {
349
+                            $counters['openings'][$char] = $key / 2;
350
+            } else {
351
+                            $counters['closings'][$char] = $key / 2;
352
+            }
352 353
         }
353 354
         // $counters = [
354 355
         //   'values'   => [0, 0, 0],
@@ -394,8 +395,9 @@  discard block
 block discarded – undo
394 395
                 $index ++;
395 396
             }
396 397
         }
397
-        if ($buffer != '')
398
-            $result[] = $buffer;
398
+        if ($buffer != '') {
399
+                    $result[] = $buffer;
400
+        }
399 401
 
400 402
         return $result;
401 403
     });
Please login to merge, or discard this patch.
src/math.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
  */
21 21
 function plus() {
22 22
     static $plus = false;
23
-    $plus = $plus ?: curry(function($x, $y){
23
+    $plus = $plus ?: curry(function($x, $y) {
24 24
         return $x + $y;
25 25
     });
26 26
     return _apply($plus, func_get_args());
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
  */
42 42
 function minus() {
43 43
     static $minus = false;
44
-    $minus = $minus ?: curry(function($x, $y){
44
+    $minus = $minus ?: curry(function($x, $y) {
45 45
         return $x - $y;
46 46
     });
47 47
     return _apply($minus, func_get_args());
@@ -62,8 +62,8 @@  discard block
 block discarded – undo
62 62
  */
63 63
 function negate() {
64 64
     static $negate = false;
65
-    $negate = $negate ?: curry(function($x){
66
-        return -$x;
65
+    $negate = $negate ?: curry(function($x) {
66
+        return - $x;
67 67
     });
68 68
     return _apply($negate, func_get_args());
69 69
 }
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
  */
85 85
 function multiply() {
86 86
     static $multiply = false;
87
-    $multiply = $multiply ?: curry(function($x, $y){
87
+    $multiply = $multiply ?: curry(function($x, $y) {
88 88
         return $y * $x;
89 89
     });
90 90
     return _apply($multiply, func_get_args());
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
  */
106 106
 function divide() {
107 107
     static $divide = false;
108
-    $divide = $divide ?: curry(function($x, $y){
108
+    $divide = $divide ?: curry(function($x, $y) {
109 109
         return $x / $y;
110 110
     });
111 111
     return _apply($divide, func_get_args());
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
  */
127 127
 function modulo() {
128 128
     static $modulo = false;
129
-    $modulo = $modulo ?: curry(function($x, $y){
129
+    $modulo = $modulo ?: curry(function($x, $y) {
130 130
         return $x % $y;
131 131
     });
132 132
     return _apply($modulo, func_get_args());
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
  */
187 187
 function min() {
188 188
     static $min = false;
189
-    $min = $min ?: curry(function($a, $b){
189
+    $min = $min ?: curry(function($a, $b) {
190 190
         return $a < $b ? $a : $b;
191 191
     });
192 192
     return _apply($min, func_get_args());
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
  */
210 210
 function minBy() {
211 211
     static $minBy = false;
212
-    $minBy = $minBy ?: curry(function($fn, $a, $b){
212
+    $minBy = $minBy ?: curry(function($fn, $a, $b) {
213 213
         return $fn($a) < $fn($b) ? $a : $b;
214 214
     });
215 215
     return _apply($minBy, func_get_args());
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
  */
232 232
 function max() {
233 233
     static $max = false;
234
-    $max = $max ?: curry(function($a, $b){
234
+    $max = $max ?: curry(function($a, $b) {
235 235
         return $a > $b ? $a : $b;
236 236
     });
237 237
     return _apply($max, func_get_args());
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
  */
255 255
 function maxBy() {
256 256
     static $maxBy = false;
257
-    $maxBy = $maxBy ?: curry(function($fn, $a, $b){
257
+    $maxBy = $maxBy ?: curry(function($fn, $a, $b) {
258 258
         return $fn($a) > $fn($b) ? $a : $b;
259 259
     });
260 260
     return _apply($maxBy, func_get_args());
Please login to merge, or discard this patch.
src/object.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
  */
174 174
 function has() {
175 175
     static $has = false;
176
-    $has = $has ?: curry(function($name, $object){
176
+    $has = $has ?: curry(function($name, $object) {
177 177
         if (is_object($object)) return isset($object->{$name});
178 178
         if (is_array($object)) return isset($object[$name]);
179 179
         return false;
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
  */
209 209
 function get() {
210 210
     static $get = false;
211
-    $get = $get ?: curry(function($name, $object){
211
+    $get = $get ?: curry(function($name, $object) {
212 212
         return is_object($object)
213 213
             ? (isset($object->{$name}) ? $object->{$name} : null)
214 214
             : (isset($object[$name]) ? $object[$name] : null);
Please login to merge, or discard this patch.
Braces   +21 added lines, -12 removed lines patch added patch discarded remove patch
@@ -80,8 +80,9 @@  discard block
 block discarded – undo
80 80
 function attributes() {
81 81
     static $attrs = false;
82 82
     $attrs = $attrs ?: curry(function($object) {
83
-        if (is_object($object))
84
-            return get_object_vars($object);
83
+        if (is_object($object)) {
84
+                    return get_object_vars($object);
85
+        }
85 86
         return $object;
86 87
     });
87 88
     return _apply($attrs, func_get_args());
@@ -174,8 +175,12 @@  discard block
 block discarded – undo
174 175
 function has() {
175 176
     static $has = false;
176 177
     $has = $has ?: curry(function($name, $object){
177
-        if (is_object($object)) return isset($object->{$name});
178
-        if (is_array($object)) return isset($object[$name]);
178
+        if (is_object($object)) {
179
+            return isset($object->{$name});
180
+        }
181
+        if (is_array($object)) {
182
+            return isset($object[$name]);
183
+        }
179 184
         return false;
180 185
     });
181 186
     return _apply($has, func_get_args());
@@ -276,8 +281,9 @@  discard block
 block discarded – undo
276 281
         if (is_object($object)) {
277 282
             $object = clone_($object);
278 283
             $object->{$name} = $value;
279
-        } else
280
-            $object[$name] = $value;
284
+        } else {
285
+                    $object[$name] = $value;
286
+        }
281 287
         return $object;
282 288
     });
283 289
     return _apply($set, func_get_args());
@@ -370,8 +376,9 @@  discard block
 block discarded – undo
370 376
     static $satisfiesAll = false;
371 377
     $satisfiesAll = $satisfiesAll ?: curry(function($predicates, $object) {
372 378
         foreach ($predicates as $key => $predicate) {
373
-            if (!satisfies($predicate, $key, $object))
374
-                return false;
379
+            if (!satisfies($predicate, $key, $object)) {
380
+                            return false;
381
+            }
375 382
         }
376 383
         return true;
377 384
     });
@@ -408,8 +415,9 @@  discard block
 block discarded – undo
408 415
     static $satisfiesAny = false;
409 416
     $satisfiesAny = $satisfiesAny ?: curry(function($predicates, $object) {
410 417
         foreach ($predicates as $key => $predicate) {
411
-            if (satisfies($predicate, $key, $object))
412
-                return true;
418
+            if (satisfies($predicate, $key, $object)) {
419
+                            return true;
420
+            }
413 421
         }
414 422
         return false;
415 423
     });
@@ -433,8 +441,9 @@  discard block
 block discarded – undo
433 441
 function toPairs() {
434 442
     static $toPairs = false;
435 443
     $toPairs = $toPairs ?: curry(function($object) {
436
-        if (is_object($object))
437
-            $object = get_object_vars($object);
444
+        if (is_object($object)) {
445
+                    $object = get_object_vars($object);
446
+        }
438 447
         $result = [];
439 448
         foreach ($object as $key => $value) {
440 449
             $result[] = [$key, $value];
Please login to merge, or discard this patch.
src/operators.php 2 patches
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
  */
23 23
 function and_() {
24 24
     static $and = false;
25
-    $and = $and ?: curry(function($a, $b){
25
+    $and = $and ?: curry(function($a, $b) {
26 26
         return $a && $b;
27 27
     });
28 28
     return _apply($and, func_get_args());
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
  */
46 46
 function or_() {
47 47
     static $or = false;
48
-    $or = $or ?: curry(function($a, $b){
48
+    $or = $or ?: curry(function($a, $b) {
49 49
         return $a || $b;
50 50
     });
51 51
     return _apply($or, func_get_args());
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
  * @return bool
86 86
  */
87 87
 function eq() {
88
-    $eq = curry(function($a, $b){
88
+    $eq = curry(function($a, $b) {
89 89
         return $a == $b;
90 90
     });
91 91
     return _apply($eq, func_get_args());
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
  */
107 107
 function notEq() {
108 108
     static $notEq = false;
109
-    $notEq = $notEq ?: curry(function($a, $b){
109
+    $notEq = $notEq ?: curry(function($a, $b) {
110 110
         return $a != $b;
111 111
     });
112 112
     return _apply($notEq, func_get_args());
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
  */
127 127
 function eqq() {
128 128
     static $eqq = false;
129
-    $eqq = $eqq ?: curry(function($a, $b){
129
+    $eqq = $eqq ?: curry(function($a, $b) {
130 130
         return $a === $b;
131 131
     });
132 132
     return _apply($eqq, func_get_args());
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
  */
148 148
 function notEqq() {
149 149
     static $notEqq = false;
150
-    $notEqq = $notEqq ?: curry(function($a, $b){
150
+    $notEqq = $notEqq ?: curry(function($a, $b) {
151 151
         return $a !== $b;
152 152
     });
153 153
     return _apply($notEqq, func_get_args());
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
  */
265 265
 function lt() {
266 266
     static $lt = false;
267
-    $lt = $lt ?: curry(function($a, $b){
267
+    $lt = $lt ?: curry(function($a, $b) {
268 268
         return $a < $b;
269 269
     });
270 270
     return _apply($lt, func_get_args());
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
  */
287 287
 function lte() {
288 288
     static $lte = false;
289
-    $lte = $lte ?: curry(function($a, $b){
289
+    $lte = $lte ?: curry(function($a, $b) {
290 290
         return $a <= $b;
291 291
     });
292 292
     return _apply($lte, func_get_args());
@@ -308,7 +308,7 @@  discard block
 block discarded – undo
308 308
  */
309 309
 function gt() {
310 310
     static $gt = false;
311
-    $gt = $gt ?: curry(function($a, $b){
311
+    $gt = $gt ?: curry(function($a, $b) {
312 312
         return $a > $b;
313 313
     });
314 314
     return _apply($gt, func_get_args());
@@ -330,7 +330,7 @@  discard block
 block discarded – undo
330 330
  */
331 331
 function gte() {
332 332
     static $gte = false;
333
-    $gte = $gte ?: curry(function($a, $b){
333
+    $gte = $gte ?: curry(function($a, $b) {
334 334
         return $a >= $b;
335 335
     });
336 336
     return _apply($gte, func_get_args());
Please login to merge, or discard this patch.
Braces   +18 added lines, -12 removed lines patch added patch discarded remove patch
@@ -184,17 +184,20 @@  discard block
 block discarded – undo
184 184
 }
185 185
 function _equals($a, $b) {
186 186
     $type = type($a);
187
-    if ($type != type($b))
188
-        return false;
187
+    if ($type != type($b)) {
188
+            return false;
189
+    }
189 190
     switch ($type) {
190 191
         case 'List':
191 192
             $length = count($a);
192
-            if (count($b) != $length)
193
-                return false;
193
+            if (count($b) != $length) {
194
+                            return false;
195
+            }
194 196
             $index = 0;
195 197
             while ($index < $length) {
196
-                if (!_equals($a[$index], $b[$index]))
197
-                    return false;
198
+                if (!_equals($a[$index], $b[$index])) {
199
+                                    return false;
200
+                }
198 201
                 $index ++;
199 202
             }
200 203
             return true;
@@ -204,14 +207,17 @@  discard block
 block discarded – undo
204 207
             $keysA = keys($a);
205 208
             $keysB = keys($b);
206 209
             $length = count($keysA);
207
-            if (count($keysB) != $length)
208
-                return false;
210
+            if (count($keysB) != $length) {
211
+                            return false;
212
+            }
209 213
             $index = 0;
210 214
             while ($index < $length) {
211
-                if (!_equals($keysA[$index], $keysB[$index]))
212
-                    return false;
213
-                if (!_equals(get($keysA[$index], $a), get($keysB[$index], $b)))
214
-                    return false;
215
+                if (!_equals($keysA[$index], $keysB[$index])) {
216
+                                    return false;
217
+                }
218
+                if (!_equals(get($keysA[$index], $a), get($keysB[$index], $b))) {
219
+                                    return false;
220
+                }
215 221
                 $index ++;
216 222
             }
217 223
             return true;
Please login to merge, or discard this patch.
src/Internal/_stream_operations.php 1 patch
Indentation   +122 added lines, -122 removed lines patch added patch discarded remove patch
@@ -3,127 +3,127 @@
 block discarded – undo
3 3
 use Tarsana\Functional as F;
4 4
 
5 5
 return F\map(F\apply(F\_f('_stream_operation')), [
6
-	['then', 'Function -> Any -> Any', F\_f('_stream_then')],
7
-	['and', 'Boolean -> Boolean -> Boolean', F\and_()],
8
-	['or', 'Boolean -> Boolean -> Boolean', F\or_()],
9
-	['not', 'Boolean -> Boolean', F\not()],
10
-	['eq', 'Any -> Any -> Boolean', F\eq()],
11
-	['notEq', 'Any -> Any -> Boolean', F\notEq()],
12
-	['eqq', 'Any -> Any -> Boolean', F\eqq()],
13
-	['notEqq', 'Any -> Any -> Boolean', F\notEqq()],
14
-	['equals', 'Any -> Any -> Boolean', F\equals()],
15
-	['equalBy', 'Function -> Any -> Any -> Boolean', F\equalBy()],
16
-	['lt', 'Any -> Any -> Boolean', F\lt()],
17
-	['lte', 'Any -> Any -> Boolean', F\lte()],
18
-	['gt', 'Any -> Any -> Boolean', F\gt()],
19
-	['gte', 'Any -> Any -> Boolean', F\gte()],
20
-	['is', 'String -> Any -> Boolean', F\is()],
21
-	['toString', 'Any -> String', F\toString()],
22
-	['attributes', 'Object|Array -> Object|Array', F\attributes()],
23
-	['keys', 'List -> List', F\keys()],
24
-	['keys', 'Object|Array -> List', F\keys()],
25
-	['values', 'List -> List', F\values()],
26
-	['values', 'Object|Array -> List', F\values()],
27
-	['has', 'Any -> Object|Array -> Boolean', F\has()],
28
-	['get', 'Any -> Object|Array -> Any', F\get()],
29
-	['getPath', 'List -> Object|Array -> Any', F\getPath()],
30
-	['set', 'Any -> Any -> Object|Array -> Object|Array', F\set()],
31
-	['update', 'Any -> Function -> Object|Array -> Object|Array', F\update()],
32
-	['satisfies', 'Function -> Any -> Object|Array -> Boolean', F\satisfies()],
33
-	['satisfiesAll', 'Object|Array -> Object|Array -> Boolean', F\satisfiesAll()],
34
-	['satisfiesAny', 'Object|Array -> Object|Array -> Boolean', F\satisfiesAny()],
35
-	['toPairs', 'Object|Array -> List', F\toPairs()],
36
-	['toPairs', 'List -> List', F\toPairs()],
37
-	['split', 'String -> String -> List', F\split()],
38
-	['join', 'String -> List -> String', F\join()],
39
-	['replace', 'String|List -> String|List -> String -> String', F\replace()],
40
-	['regReplace', 'String -> String -> String -> String', F\regReplace()],
41
-	['upperCase', 'String -> String', F\upperCase()],
42
-	['lowerCase', 'String -> String', F\lowerCase()],
43
-	['camelCase', 'String -> String', F\camelCase()],
44
-	['snakeCase', 'String -> String -> String', F\snakeCase()],
45
-	['startsWith', 'String -> String -> Boolean', F\startsWith()],
46
-	['endsWith', 'String -> String -> Boolean', F\endsWith()],
47
-	['test', 'String -> String -> Boolean', F\test()],
48
-	['match', 'String -> String -> List', F\match()],
49
-	['occurences', 'String -> String -> Number', F\occurences()],
50
-	['chunks', 'String -> String -> String -> List', F\chunks()],
51
-	['map', 'Function -> List -> List', F\map()],
52
-	['map', 'Function -> Object|Array -> Object|Array', F\map()],
53
-	['chain', 'Function -> List -> List', F\chain()],
54
-	['filter', 'Function -> List -> List', F\filter()],
55
-	['reduce', 'Function -> Any -> List -> Any', F\reduce()],
56
-	['each', 'Function -> List -> List', F\each()],
57
-	['head', 'List -> Any', F\head()],
58
-	['head', 'String -> String', F\head()],
59
-	['last', 'List -> Any', F\last()],
60
-	['last', 'String -> String', F\last()],
61
-	['init', 'List -> Any', F\init()],
62
-	['init', 'String -> String', F\init()],
63
-	['tail', 'List -> Any', F\tail()],
64
-	['tail', 'String -> String', F\tail()],
65
-	['reverse', 'List -> List', F\reverse()],
66
-	['reverse', 'String -> String', F\reverse()],
67
-	['length', 'List -> Number', F\length()],
68
-	['length', 'String -> Number', F\length()],
69
-	['allSatisfies', 'Function -> List -> Boolean', F\allSatisfies()],
70
-	['anySatisfies', 'Function -> List -> Boolean', F\anySatisfies()],
71
-	['concat', 'List -> List -> List', F\concat()],
72
-	['concat', 'String -> String -> String', F\concat()],
73
-	['concatAll', 'List -> List', F\concatAll()],
74
-	['insert', 'Number -> Any -> List -> List', F\insert()],
75
-	['insert', 'Number -> String -> String -> String', F\insert()],
76
-	['insertAll', 'Number -> List -> List -> List', F\insertAll()],
77
-	['insertAll', 'Number -> String -> String -> String', F\insertAll()],
78
-	['append', 'Any -> List -> List', F\append()],
79
-	['append', 'String -> String -> String', F\append()],
80
-	['prepend', 'Any -> List -> List', F\prepend()],
81
-	['prepend', 'String -> String -> String', F\prepend()],
82
-	['take', 'Number -> List -> List', F\take()],
83
-	['take', 'Number -> String -> String', F\take()],
84
-	['takeWhile', 'Function -> List -> List', F\takeWhile()],
85
-	['takeLastWhile', 'Function -> List -> List', F\takeLastWhile()],
86
-	['takeUntil', 'Function -> List -> List', F\takeUntil()],
87
-	['takeLastUntil', 'Function -> List -> List', F\takeLastUntil()],
88
-	['remove', 'Number -> List -> List', F\remove()],
89
-	['remove', 'Number -> String -> String', F\remove()],
90
-	['removeWhile', 'Function -> List -> List', F\removeWhile()],
91
-	['removeLastWhile', 'Function -> List -> List', F\removeLastWhile()],
92
-	['removeUntil', 'Function -> List -> List', F\removeUntil()],
93
-	['removeLastUntil', 'Function -> List -> List', F\removeLastUntil()],
94
-	['fromPairs', 'List -> Object|Array', F\fromPairs()],
95
-	['slices', 'Number -> List -> List', F\slices()],
96
-	['slices', 'Number -> String -> List', F\slices()],
97
-	['contains', 'Any -> List -> Boolean', F\contains()],
98
-	['contains', 'String -> String -> Boolean', F\contains()],
99
-	['findIndex', 'Function -> List -> Number|Null', F\findIndex()],
100
-	['findIndex', 'Function -> Object|Array -> Any', F\findIndex()],
101
-	['findLastIndex', 'Function -> List -> Number|Null', F\findLastIndex()],
102
-	['findLastIndex', 'Function -> Object|Array -> Any', F\findLastIndex()],
103
-	['find', 'Function -> List -> Any', F\find()],
104
-	['findLast', 'Function -> List -> Any', F\findLast()],
105
-	['indexOf', 'Any -> List -> Number', F\indexOf()],
106
-	['indexOf', 'Any -> Object|Array -> Any', F\indexOf()],
107
-	['indexOf', 'String -> String -> Number', F\indexOf()],
108
-	['lastIndexOf', 'Any -> List -> Number', F\lastIndexOf()],
109
-	['lastIndexOf', 'Any -> Object|Array -> Any', F\lastIndexOf()],
110
-	['lastIndexOf', 'String -> String -> Number', F\lastIndexOf()],
111
-	['uniqueBy', 'Function -> List -> List', F\uniqueBy()],
112
-	['unique', 'List -> List', F\unique()],
113
-	['groupBy', 'Function -> List -> Object|Array', F\groupBy()],
114
-	['pairsFrom', 'List -> List -> List', F\pairsFrom()],
115
-	['sort', 'Function -> List -> List', F\sort()],
116
-	['plus', 'Number -> Number -> Number', F\plus()],
117
-	['minus', 'Number -> Number -> Number', F\minus()],
118
-	['negate', 'Number -> Number', F\negate()],
119
-	['multiply', 'Number -> Number -> Number', F\multiply()],
120
-	['divide', 'Number -> Number -> Number', F\divide()],
121
-	['modulo', 'Number -> Number -> Number', F\modulo()],
122
-	['sum', 'List -> Number', F\sum()],
123
-	['product', 'List -> Number', F\product()],
124
-	['min', 'Number -> Number -> Number', F\min()],
125
-	['minBy', 'Function -> Any -> Any -> Any', F\minBy()],
126
-	['max', 'Number -> Number -> Number', F\max()],
127
-	['maxBy', 'Function -> Any -> Any -> Any', F\maxBy()],
6
+    ['then', 'Function -> Any -> Any', F\_f('_stream_then')],
7
+    ['and', 'Boolean -> Boolean -> Boolean', F\and_()],
8
+    ['or', 'Boolean -> Boolean -> Boolean', F\or_()],
9
+    ['not', 'Boolean -> Boolean', F\not()],
10
+    ['eq', 'Any -> Any -> Boolean', F\eq()],
11
+    ['notEq', 'Any -> Any -> Boolean', F\notEq()],
12
+    ['eqq', 'Any -> Any -> Boolean', F\eqq()],
13
+    ['notEqq', 'Any -> Any -> Boolean', F\notEqq()],
14
+    ['equals', 'Any -> Any -> Boolean', F\equals()],
15
+    ['equalBy', 'Function -> Any -> Any -> Boolean', F\equalBy()],
16
+    ['lt', 'Any -> Any -> Boolean', F\lt()],
17
+    ['lte', 'Any -> Any -> Boolean', F\lte()],
18
+    ['gt', 'Any -> Any -> Boolean', F\gt()],
19
+    ['gte', 'Any -> Any -> Boolean', F\gte()],
20
+    ['is', 'String -> Any -> Boolean', F\is()],
21
+    ['toString', 'Any -> String', F\toString()],
22
+    ['attributes', 'Object|Array -> Object|Array', F\attributes()],
23
+    ['keys', 'List -> List', F\keys()],
24
+    ['keys', 'Object|Array -> List', F\keys()],
25
+    ['values', 'List -> List', F\values()],
26
+    ['values', 'Object|Array -> List', F\values()],
27
+    ['has', 'Any -> Object|Array -> Boolean', F\has()],
28
+    ['get', 'Any -> Object|Array -> Any', F\get()],
29
+    ['getPath', 'List -> Object|Array -> Any', F\getPath()],
30
+    ['set', 'Any -> Any -> Object|Array -> Object|Array', F\set()],
31
+    ['update', 'Any -> Function -> Object|Array -> Object|Array', F\update()],
32
+    ['satisfies', 'Function -> Any -> Object|Array -> Boolean', F\satisfies()],
33
+    ['satisfiesAll', 'Object|Array -> Object|Array -> Boolean', F\satisfiesAll()],
34
+    ['satisfiesAny', 'Object|Array -> Object|Array -> Boolean', F\satisfiesAny()],
35
+    ['toPairs', 'Object|Array -> List', F\toPairs()],
36
+    ['toPairs', 'List -> List', F\toPairs()],
37
+    ['split', 'String -> String -> List', F\split()],
38
+    ['join', 'String -> List -> String', F\join()],
39
+    ['replace', 'String|List -> String|List -> String -> String', F\replace()],
40
+    ['regReplace', 'String -> String -> String -> String', F\regReplace()],
41
+    ['upperCase', 'String -> String', F\upperCase()],
42
+    ['lowerCase', 'String -> String', F\lowerCase()],
43
+    ['camelCase', 'String -> String', F\camelCase()],
44
+    ['snakeCase', 'String -> String -> String', F\snakeCase()],
45
+    ['startsWith', 'String -> String -> Boolean', F\startsWith()],
46
+    ['endsWith', 'String -> String -> Boolean', F\endsWith()],
47
+    ['test', 'String -> String -> Boolean', F\test()],
48
+    ['match', 'String -> String -> List', F\match()],
49
+    ['occurences', 'String -> String -> Number', F\occurences()],
50
+    ['chunks', 'String -> String -> String -> List', F\chunks()],
51
+    ['map', 'Function -> List -> List', F\map()],
52
+    ['map', 'Function -> Object|Array -> Object|Array', F\map()],
53
+    ['chain', 'Function -> List -> List', F\chain()],
54
+    ['filter', 'Function -> List -> List', F\filter()],
55
+    ['reduce', 'Function -> Any -> List -> Any', F\reduce()],
56
+    ['each', 'Function -> List -> List', F\each()],
57
+    ['head', 'List -> Any', F\head()],
58
+    ['head', 'String -> String', F\head()],
59
+    ['last', 'List -> Any', F\last()],
60
+    ['last', 'String -> String', F\last()],
61
+    ['init', 'List -> Any', F\init()],
62
+    ['init', 'String -> String', F\init()],
63
+    ['tail', 'List -> Any', F\tail()],
64
+    ['tail', 'String -> String', F\tail()],
65
+    ['reverse', 'List -> List', F\reverse()],
66
+    ['reverse', 'String -> String', F\reverse()],
67
+    ['length', 'List -> Number', F\length()],
68
+    ['length', 'String -> Number', F\length()],
69
+    ['allSatisfies', 'Function -> List -> Boolean', F\allSatisfies()],
70
+    ['anySatisfies', 'Function -> List -> Boolean', F\anySatisfies()],
71
+    ['concat', 'List -> List -> List', F\concat()],
72
+    ['concat', 'String -> String -> String', F\concat()],
73
+    ['concatAll', 'List -> List', F\concatAll()],
74
+    ['insert', 'Number -> Any -> List -> List', F\insert()],
75
+    ['insert', 'Number -> String -> String -> String', F\insert()],
76
+    ['insertAll', 'Number -> List -> List -> List', F\insertAll()],
77
+    ['insertAll', 'Number -> String -> String -> String', F\insertAll()],
78
+    ['append', 'Any -> List -> List', F\append()],
79
+    ['append', 'String -> String -> String', F\append()],
80
+    ['prepend', 'Any -> List -> List', F\prepend()],
81
+    ['prepend', 'String -> String -> String', F\prepend()],
82
+    ['take', 'Number -> List -> List', F\take()],
83
+    ['take', 'Number -> String -> String', F\take()],
84
+    ['takeWhile', 'Function -> List -> List', F\takeWhile()],
85
+    ['takeLastWhile', 'Function -> List -> List', F\takeLastWhile()],
86
+    ['takeUntil', 'Function -> List -> List', F\takeUntil()],
87
+    ['takeLastUntil', 'Function -> List -> List', F\takeLastUntil()],
88
+    ['remove', 'Number -> List -> List', F\remove()],
89
+    ['remove', 'Number -> String -> String', F\remove()],
90
+    ['removeWhile', 'Function -> List -> List', F\removeWhile()],
91
+    ['removeLastWhile', 'Function -> List -> List', F\removeLastWhile()],
92
+    ['removeUntil', 'Function -> List -> List', F\removeUntil()],
93
+    ['removeLastUntil', 'Function -> List -> List', F\removeLastUntil()],
94
+    ['fromPairs', 'List -> Object|Array', F\fromPairs()],
95
+    ['slices', 'Number -> List -> List', F\slices()],
96
+    ['slices', 'Number -> String -> List', F\slices()],
97
+    ['contains', 'Any -> List -> Boolean', F\contains()],
98
+    ['contains', 'String -> String -> Boolean', F\contains()],
99
+    ['findIndex', 'Function -> List -> Number|Null', F\findIndex()],
100
+    ['findIndex', 'Function -> Object|Array -> Any', F\findIndex()],
101
+    ['findLastIndex', 'Function -> List -> Number|Null', F\findLastIndex()],
102
+    ['findLastIndex', 'Function -> Object|Array -> Any', F\findLastIndex()],
103
+    ['find', 'Function -> List -> Any', F\find()],
104
+    ['findLast', 'Function -> List -> Any', F\findLast()],
105
+    ['indexOf', 'Any -> List -> Number', F\indexOf()],
106
+    ['indexOf', 'Any -> Object|Array -> Any', F\indexOf()],
107
+    ['indexOf', 'String -> String -> Number', F\indexOf()],
108
+    ['lastIndexOf', 'Any -> List -> Number', F\lastIndexOf()],
109
+    ['lastIndexOf', 'Any -> Object|Array -> Any', F\lastIndexOf()],
110
+    ['lastIndexOf', 'String -> String -> Number', F\lastIndexOf()],
111
+    ['uniqueBy', 'Function -> List -> List', F\uniqueBy()],
112
+    ['unique', 'List -> List', F\unique()],
113
+    ['groupBy', 'Function -> List -> Object|Array', F\groupBy()],
114
+    ['pairsFrom', 'List -> List -> List', F\pairsFrom()],
115
+    ['sort', 'Function -> List -> List', F\sort()],
116
+    ['plus', 'Number -> Number -> Number', F\plus()],
117
+    ['minus', 'Number -> Number -> Number', F\minus()],
118
+    ['negate', 'Number -> Number', F\negate()],
119
+    ['multiply', 'Number -> Number -> Number', F\multiply()],
120
+    ['divide', 'Number -> Number -> Number', F\divide()],
121
+    ['modulo', 'Number -> Number -> Number', F\modulo()],
122
+    ['sum', 'List -> Number', F\sum()],
123
+    ['product', 'List -> Number', F\product()],
124
+    ['min', 'Number -> Number -> Number', F\min()],
125
+    ['minBy', 'Function -> Any -> Any -> Any', F\minBy()],
126
+    ['max', 'Number -> Number -> Number', F\max()],
127
+    ['maxBy', 'Function -> Any -> Any -> Any', F\maxBy()],
128 128
 
129 129
 ]);
Please login to merge, or discard this patch.