Completed
Push — master ( 482bb6...bff53a )
by Amine
03:17
created
src/list.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
  * @return array
37 37
  */
38 38
 function filter() {
39
-    $filter = function($fn, $list){
39
+    $filter = function($fn, $list) {
40 40
         return array_values(array_filter($list, $fn));
41 41
     };
42 42
     return apply(curry($filter), func_get_args());
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
  * @return array
63 63
  */
64 64
 function reduce() {
65
-    $reduce = function($fn, $initial, $list){
65
+    $reduce = function($fn, $initial, $list) {
66 66
         return array_reduce($list, $fn, $initial);
67 67
     };
68 68
     return apply(curry($reduce), func_get_args());
@@ -87,8 +87,8 @@  discard block
 block discarded – undo
87 87
  * @param  array $list
88 88
  * @return array
89 89
  */
90
-function forEach() {
91
-    $forEach = function($fn, $list){
90
+function forEach () {
91
+    $forEach = function($fn, $list) {
92 92
         foreach ($list as $item) {
93 93
             apply($fn, [$item]);
94 94
         }
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
  * @return mixed
113 113
  */
114 114
 function head($list) {
115
-    if(is_string($list))
115
+    if (is_string($list))
116 116
         return substr($list, 0, 1);
117 117
     return (count($list) > 0)
118 118
         ? $list[0]
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
  * @return mixed
135 135
  */
136 136
 function last($list) {
137
-    if(is_string($list))
137
+    if (is_string($list))
138 138
         return substr($list, -1);
139 139
     return (count($list) > 0)
140 140
         ? $list[count($list) - 1]
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
  * @return array
158 158
  */
159 159
 function init($list) {
160
-    if(is_string($list))
160
+    if (is_string($list))
161 161
         return (strlen($list) > 1)
162 162
             ? substr($list, 0, strlen($list) - 1)
163 163
             : '';
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
  * @return array
183 183
  */
184 184
 function tail($list) {
185
-    if(is_string($list))
185
+    if (is_string($list))
186 186
         return (strlen($list) > 1)
187 187
             ? substr($list, 1)
188 188
             : '';
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
  * @return array
306 306
  */
307 307
 function append() {
308
-    $append = function ($item, $list) {
308
+    $append = function($item, $list) {
309 309
         if (is_string($list))
310 310
             return $list . $item;
311 311
         return array_merge($list, [$item]);
@@ -328,7 +328,7 @@  discard block
 block discarded – undo
328 328
  * @return array
329 329
  */
330 330
 function prepend() {
331
-    $prepend = function ($item, $list) {
331
+    $prepend = function($item, $list) {
332 332
         if (is_string($list))
333 333
             return $item . $list;
334 334
         return array_merge([$item], $list);
@@ -356,7 +356,7 @@  discard block
 block discarded – undo
356 356
  */
357 357
 function take() {
358 358
     $take = function($count, $list) {
359
-        if(is_string($list)) {
359
+        if (is_string($list)) {
360 360
             return ($count >= 0)
361 361
                 ? substr($list, 0, $count)
362 362
                 : substr($list, $count);
@@ -393,7 +393,7 @@  discard block
 block discarded – undo
393 393
  */
394 394
 function remove() {
395 395
     $remove = function($count, $list) {
396
-        if(is_string($list)) {
396
+        if (is_string($list)) {
397 397
             return ($count >= 0)
398 398
                 ? substr($list, $count)
399 399
                 : substr($list, 0, $count);
@@ -451,9 +451,9 @@  discard block
 block discarded – undo
451 451
  */
452 452
 function slices() {
453 453
     $slices = function($size, $list) {
454
-        if(empty($list))
454
+        if (empty($list))
455 455
             return is_string($list) ? '' : [];
456
-        if(length($list) <= $size)
456
+        if (length($list) <= $size)
457 457
             return [$list];
458 458
         return prepend(take($size, $list), slices($size, remove($size, $list)));
459 459
     };
@@ -477,7 +477,7 @@  discard block
 block discarded – undo
477 477
  */
478 478
 function contains() {
479 479
     $contains = function($item, $list) {
480
-        if(is_string($list))
480
+        if (is_string($list))
481 481
             return false !== strpos($list, $item);
482 482
         return in_array($item, $list);
483 483
     };
Please login to merge, or discard this patch.
src/object.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
  * @return mixed
25 25
  */
26 26
 function value() {
27
-    $value = function($name, $array){
27
+    $value = function($name, $array) {
28 28
         return ('Object' == type($array))
29 29
             ? $array->{$name}
30 30
             : $array[$name];
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
  * @return mixed
58 58
  */
59 59
 function has() {
60
-    $has = function($name, $array){
60
+    $has = function($name, $array) {
61 61
         return ('Object' == type($array))
62 62
             ? isset($array->{$name})
63 63
             : isset($array[$name]);
Please login to merge, or discard this patch.