Completed
Push — master ( 6e9d6d...537dfc )
by Amine
02:21 queued 22s
created
src/Classes/Error.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@
 block discarded – undo
18 18
      * @param  Error|null $error
19 19
      * @return Error
20 20
      */
21
-    public static function of ($message, $code = 0, Error $error = null)
21
+    public static function of($message, $code = 0, Error $error = null)
22 22
     {
23 23
         return new Error($message, $code, $error);
24 24
     }
Please login to merge, or discard this patch.
src/Classes/Placeholder.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -8,14 +8,14 @@
 block discarded – undo
8 8
  */
9 9
 class Placeholder {
10 10
     private static $instance;
11
-    private function __construct(){}
11
+    private function __construct() {}
12 12
     public static function get()
13 13
     {
14
-        if(static::$instance === null)
14
+        if (static::$instance === null)
15 15
             static::$instance = new Placeholder;
16 16
         return static::$instance;
17 17
     }
18
-    public function __toString(){
18
+    public function __toString() {
19 19
         return '__';
20 20
     }
21 21
 }
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -11,8 +11,9 @@
 block discarded – undo
11 11
     private function __construct(){}
12 12
     public static function get()
13 13
     {
14
-        if(static::$instance === null)
15
-            static::$instance = new Placeholder;
14
+        if(static::$instance === null) {
15
+                    static::$instance = new Placeholder;
16
+        }
16 17
         return static::$instance;
17 18
     }
18 19
     public function __toString(){
Please login to merge, or discard this patch.
src/functions.php 3 patches
Doc Comments   +2 added lines, -10 removed lines patch added patch discarded remove patch
@@ -65,8 +65,6 @@  discard block
 block discarded – undo
65 65
  * ```
66 66
  *
67 67
  * @signature (*... -> a) -> [*] -> a
68
- * @param  callable $fn
69
- * @param  array    $args
70 68
  * @return mixed
71 69
  */
72 70
 function apply() {
@@ -89,7 +87,6 @@  discard block
 block discarded – undo
89 87
  * ```
90 88
  *
91 89
  * @signature (((a, b, ...) -> o), (o -> p), ..., (y -> z)) -> ((a, b, ...) -> z)
92
- * @param  callable $fns...
93 90
  * @return callable
94 91
  */
95 92
 function pipe() {
@@ -137,7 +134,6 @@  discard block
 block discarded – undo
137 134
  * ```
138 135
  *
139 136
  * @signature a -> (* -> a)
140
- * @param  mixed $value
141 137
  * @return callable
142 138
  */
143 139
 function give() {
@@ -166,8 +162,7 @@  discard block
 block discarded – undo
166 162
  * ```
167 163
  *
168 164
  * @signature ((a -> Boolean), ..., (a -> Boolean)) -> (a -> Boolean)
169
- * @param  callable $predicates...
170
- * @return callable
165
+ * @return \Closure
171 166
  */
172 167
 function all() {
173 168
     $predicates = func_get_args();
@@ -198,8 +193,7 @@  discard block
 block discarded – undo
198 193
  * ```
199 194
  *
200 195
  * @signature ((a -> Boolean), ..., (a -> Boolean)) -> (a -> Boolean)
201
- * @param  callable $predicates...
202
- * @return callable
196
+ * @return \Closure
203 197
  */
204 198
 function any() {
205 199
     $predicates = func_get_args();
@@ -227,7 +221,6 @@  discard block
 block discarded – undo
227 221
  * ```
228 222
  *
229 223
  * @signature (* -> ... -> *) -> (* -> ... -> Boolean)
230
- * @param  callable $fn
231 224
  * @return callable
232 225
  */
233 226
 function complement() {
@@ -258,7 +251,6 @@  discard block
 block discarded – undo
258 251
  * ```
259 252
  *
260 253
  * @signature (a -> a -> Boolean) -> (a -> a -> Number)
261
- * @param  callable $fn
262 254
  * @return callable
263 255
  */
264 256
 function comparator() {
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -94,9 +94,9 @@  discard block
 block discarded – undo
94 94
  */
95 95
 function pipe() {
96 96
     $fns = func_get_args();
97
-    if(count($fns) < 1)
97
+    if (count($fns) < 1)
98 98
         return identity();
99
-    return curry(function () use ($fns) {
99
+    return curry(function() use ($fns) {
100 100
         $result = _apply(array_shift($fns), func_get_args());
101 101
         foreach ($fns as $fn) {
102 102
             $result = $fn($result);
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
     static $comparator = false;
266 266
     $comparator = $comparator ?: curry(function($fn) {
267 267
         return function($a, $b) use($fn) {
268
-            if ($fn($a, $b)) return -1;
268
+            if ($fn($a, $b)) return - 1;
269 269
             if ($fn($b, $a)) return 1;
270 270
             return 0;
271 271
         };
Please login to merge, or discard this patch.
Braces   +9 added lines, -4 removed lines patch added patch discarded remove patch
@@ -94,8 +94,9 @@  discard block
 block discarded – undo
94 94
  */
95 95
 function pipe() {
96 96
     $fns = func_get_args();
97
-    if(count($fns) < 1)
98
-        return identity();
97
+    if(count($fns) < 1) {
98
+            return identity();
99
+    }
99 100
     return curry(function () use ($fns) {
100 101
         $result = _apply(array_shift($fns), func_get_args());
101 102
         foreach ($fns as $fn) {
@@ -265,8 +266,12 @@  discard block
 block discarded – undo
265 266
     static $comparator = false;
266 267
     $comparator = $comparator ?: curry(function($fn) {
267 268
         return function($a, $b) use($fn) {
268
-            if ($fn($a, $b)) return -1;
269
-            if ($fn($b, $a)) return 1;
269
+            if ($fn($a, $b)) {
270
+                return -1;
271
+            }
272
+            if ($fn($b, $a)) {
273
+                return 1;
274
+            }
270 275
             return 0;
271 276
         };
272 277
     });
Please login to merge, or discard this patch.
src/Internal/_stream_operations.php 1 patch
Indentation   +119 added lines, -119 removed lines patch added patch discarded remove patch
@@ -3,124 +3,124 @@
 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
-	['split', 'String -> String -> List', F\split()],
37
-	['join', 'String -> List -> String', F\join()],
38
-	['replace', 'String|List -> String|List -> String -> String', F\replace()],
39
-	['regReplace', 'String -> String -> String -> String', F\regReplace()],
40
-	['upperCase', 'String -> String', F\upperCase()],
41
-	['lowerCase', 'String -> String', F\lowerCase()],
42
-	['camelCase', 'String -> String', F\camelCase()],
43
-	['snakeCase', 'String -> String -> String', F\snakeCase()],
44
-	['startsWith', 'String -> String -> Boolean', F\startsWith()],
45
-	['endsWith', 'String -> String -> Boolean', F\endsWith()],
46
-	['test', 'String -> String -> Boolean', F\test()],
47
-	['match', 'String -> String -> List', F\match()],
48
-	['occurences', 'String -> String -> Number', F\occurences()],
49
-	['chunks', 'String -> String -> String -> List', F\chunks()],
50
-	['map', 'Function -> List -> List', F\map()],
51
-	['chain', 'Function -> List -> List', F\chain()],
52
-	['filter', 'Function -> List -> List', F\filter()],
53
-	['reduce', 'Function -> Any -> List -> Any', F\reduce()],
54
-	['each', 'Function -> List -> List', F\each()],
55
-	['head', 'List -> Any', F\head()],
56
-	['head', 'String -> String', F\head()],
57
-	['last', 'List -> Any', F\last()],
58
-	['last', 'String -> String', F\last()],
59
-	['init', 'List -> Any', F\init()],
60
-	['init', 'String -> String', F\init()],
61
-	['tail', 'List -> Any', F\tail()],
62
-	['tail', 'String -> String', F\tail()],
63
-	['reverse', 'List -> List', F\reverse()],
64
-	['reverse', 'String -> String', F\reverse()],
65
-	['length', 'List -> Number', F\length()],
66
-	['length', 'String -> Number', F\length()],
67
-	['allSatisfies', 'Function -> List -> Boolean', F\allSatisfies()],
68
-	['anySatisfies', 'Function -> List -> Boolean', F\anySatisfies()],
69
-	['concat', 'List -> List -> List', F\concat()],
70
-	['concat', 'String -> String -> String', F\concat()],
71
-	['concatAll', 'List -> List', F\concatAll()],
72
-	['insert', 'Number -> Any -> List -> List', F\insert()],
73
-	['insert', 'Number -> String -> String -> String', F\insert()],
74
-	['insertAll', 'Number -> List -> List -> List', F\insertAll()],
75
-	['insertAll', 'Number -> String -> String -> String', F\insertAll()],
76
-	['append', 'Any -> List -> List', F\append()],
77
-	['append', 'String -> String -> String', F\append()],
78
-	['prepend', 'Any -> List -> List', F\prepend()],
79
-	['prepend', 'String -> String -> String', F\prepend()],
80
-	['take', 'Number -> List -> List', F\take()],
81
-	['take', 'Number -> String -> String', F\take()],
82
-	['takeWhile', 'Function -> List -> List', F\takeWhile()],
83
-	['takeLastWhile', 'Function -> List -> List', F\takeLastWhile()],
84
-	['takeUntil', 'Function -> List -> List', F\takeUntil()],
85
-	['takeLastUntil', 'Function -> List -> List', F\takeLastUntil()],
86
-	['remove', 'Number -> List -> List', F\remove()],
87
-	['remove', 'Number -> String -> String', F\remove()],
88
-	['removeWhile', 'Function -> List -> List', F\removeWhile()],
89
-	['removeLastWhile', 'Function -> List -> List', F\removeLastWhile()],
90
-	['removeUntil', 'Function -> List -> List', F\removeUntil()],
91
-	['removeLastUntil', 'Function -> List -> List', F\removeLastUntil()],
92
-	['fromPairs', 'List -> Object|Array', F\fromPairs()],
93
-	['slices', 'Number -> List -> List', F\slices()],
94
-	['slices', 'Number -> String -> List', F\slices()],
95
-	['contains', 'Any -> List -> Boolean', F\contains()],
96
-	['contains', 'String -> String -> Boolean', F\contains()],
97
-	['findIndex', 'Function -> List -> Number|Null', F\findIndex()],
98
-	['findIndex', 'Function -> Object|Array -> Any', F\findIndex()],
99
-	['findLastIndex', 'Function -> List -> Number|Null', F\findLastIndex()],
100
-	['findLastIndex', 'Function -> Object|Array -> Any', F\findLastIndex()],
101
-	['find', 'Function -> List -> Any', F\find()],
102
-	['findLast', 'Function -> List -> Any', F\findLast()],
103
-	['indexOf', 'Any -> List -> Number', F\indexOf()],
104
-	['indexOf', 'Any -> Object|Array -> Any', F\indexOf()],
105
-	['indexOf', 'String -> String -> Number', F\indexOf()],
106
-	['lastIndexOf', 'Any -> List -> Number', F\lastIndexOf()],
107
-	['lastIndexOf', 'String -> String -> Number', F\lastIndexOf()],
108
-	['uniqueBy', 'Function -> List -> List', F\uniqueBy()],
109
-	['unique', 'List -> List', F\unique()],
110
-	['groupBy', 'Function -> List -> Object|Array', F\groupBy()],
111
-	['pairsFrom', 'List -> List -> List', F\pairsFrom()],
112
-	['sort', 'Function -> List -> List', F\sort()],
113
-	['plus', 'Number -> Number -> Number', F\plus()],
114
-	['minus', 'Number -> Number -> Number', F\minus()],
115
-	['negate', 'Number -> Number', F\negate()],
116
-	['multiply', 'Number -> Number -> Number', F\multiply()],
117
-	['divide', 'Number -> Number -> Number', F\divide()],
118
-	['modulo', 'Number -> Number -> Number', F\modulo()],
119
-	['sum', 'List -> Number', F\sum()],
120
-	['product', 'List -> Number', F\product()],
121
-	['min', 'Number -> Number -> Number', F\min()],
122
-	['minBy', 'Function -> Any -> Any -> Any', F\minBy()],
123
-	['max', 'Number -> Number -> Number', F\max()],
124
-	['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
+    ['split', 'String -> String -> List', F\split()],
37
+    ['join', 'String -> List -> String', F\join()],
38
+    ['replace', 'String|List -> String|List -> String -> String', F\replace()],
39
+    ['regReplace', 'String -> String -> String -> String', F\regReplace()],
40
+    ['upperCase', 'String -> String', F\upperCase()],
41
+    ['lowerCase', 'String -> String', F\lowerCase()],
42
+    ['camelCase', 'String -> String', F\camelCase()],
43
+    ['snakeCase', 'String -> String -> String', F\snakeCase()],
44
+    ['startsWith', 'String -> String -> Boolean', F\startsWith()],
45
+    ['endsWith', 'String -> String -> Boolean', F\endsWith()],
46
+    ['test', 'String -> String -> Boolean', F\test()],
47
+    ['match', 'String -> String -> List', F\match()],
48
+    ['occurences', 'String -> String -> Number', F\occurences()],
49
+    ['chunks', 'String -> String -> String -> List', F\chunks()],
50
+    ['map', 'Function -> List -> List', F\map()],
51
+    ['chain', 'Function -> List -> List', F\chain()],
52
+    ['filter', 'Function -> List -> List', F\filter()],
53
+    ['reduce', 'Function -> Any -> List -> Any', F\reduce()],
54
+    ['each', 'Function -> List -> List', F\each()],
55
+    ['head', 'List -> Any', F\head()],
56
+    ['head', 'String -> String', F\head()],
57
+    ['last', 'List -> Any', F\last()],
58
+    ['last', 'String -> String', F\last()],
59
+    ['init', 'List -> Any', F\init()],
60
+    ['init', 'String -> String', F\init()],
61
+    ['tail', 'List -> Any', F\tail()],
62
+    ['tail', 'String -> String', F\tail()],
63
+    ['reverse', 'List -> List', F\reverse()],
64
+    ['reverse', 'String -> String', F\reverse()],
65
+    ['length', 'List -> Number', F\length()],
66
+    ['length', 'String -> Number', F\length()],
67
+    ['allSatisfies', 'Function -> List -> Boolean', F\allSatisfies()],
68
+    ['anySatisfies', 'Function -> List -> Boolean', F\anySatisfies()],
69
+    ['concat', 'List -> List -> List', F\concat()],
70
+    ['concat', 'String -> String -> String', F\concat()],
71
+    ['concatAll', 'List -> List', F\concatAll()],
72
+    ['insert', 'Number -> Any -> List -> List', F\insert()],
73
+    ['insert', 'Number -> String -> String -> String', F\insert()],
74
+    ['insertAll', 'Number -> List -> List -> List', F\insertAll()],
75
+    ['insertAll', 'Number -> String -> String -> String', F\insertAll()],
76
+    ['append', 'Any -> List -> List', F\append()],
77
+    ['append', 'String -> String -> String', F\append()],
78
+    ['prepend', 'Any -> List -> List', F\prepend()],
79
+    ['prepend', 'String -> String -> String', F\prepend()],
80
+    ['take', 'Number -> List -> List', F\take()],
81
+    ['take', 'Number -> String -> String', F\take()],
82
+    ['takeWhile', 'Function -> List -> List', F\takeWhile()],
83
+    ['takeLastWhile', 'Function -> List -> List', F\takeLastWhile()],
84
+    ['takeUntil', 'Function -> List -> List', F\takeUntil()],
85
+    ['takeLastUntil', 'Function -> List -> List', F\takeLastUntil()],
86
+    ['remove', 'Number -> List -> List', F\remove()],
87
+    ['remove', 'Number -> String -> String', F\remove()],
88
+    ['removeWhile', 'Function -> List -> List', F\removeWhile()],
89
+    ['removeLastWhile', 'Function -> List -> List', F\removeLastWhile()],
90
+    ['removeUntil', 'Function -> List -> List', F\removeUntil()],
91
+    ['removeLastUntil', 'Function -> List -> List', F\removeLastUntil()],
92
+    ['fromPairs', 'List -> Object|Array', F\fromPairs()],
93
+    ['slices', 'Number -> List -> List', F\slices()],
94
+    ['slices', 'Number -> String -> List', F\slices()],
95
+    ['contains', 'Any -> List -> Boolean', F\contains()],
96
+    ['contains', 'String -> String -> Boolean', F\contains()],
97
+    ['findIndex', 'Function -> List -> Number|Null', F\findIndex()],
98
+    ['findIndex', 'Function -> Object|Array -> Any', F\findIndex()],
99
+    ['findLastIndex', 'Function -> List -> Number|Null', F\findLastIndex()],
100
+    ['findLastIndex', 'Function -> Object|Array -> Any', F\findLastIndex()],
101
+    ['find', 'Function -> List -> Any', F\find()],
102
+    ['findLast', 'Function -> List -> Any', F\findLast()],
103
+    ['indexOf', 'Any -> List -> Number', F\indexOf()],
104
+    ['indexOf', 'Any -> Object|Array -> Any', F\indexOf()],
105
+    ['indexOf', 'String -> String -> Number', F\indexOf()],
106
+    ['lastIndexOf', 'Any -> List -> Number', F\lastIndexOf()],
107
+    ['lastIndexOf', 'String -> String -> Number', F\lastIndexOf()],
108
+    ['uniqueBy', 'Function -> List -> List', F\uniqueBy()],
109
+    ['unique', 'List -> List', F\unique()],
110
+    ['groupBy', 'Function -> List -> Object|Array', F\groupBy()],
111
+    ['pairsFrom', 'List -> List -> List', F\pairsFrom()],
112
+    ['sort', 'Function -> List -> List', F\sort()],
113
+    ['plus', 'Number -> Number -> Number', F\plus()],
114
+    ['minus', 'Number -> Number -> Number', F\minus()],
115
+    ['negate', 'Number -> Number', F\negate()],
116
+    ['multiply', 'Number -> Number -> Number', F\multiply()],
117
+    ['divide', 'Number -> Number -> Number', F\divide()],
118
+    ['modulo', 'Number -> Number -> Number', F\modulo()],
119
+    ['sum', 'List -> Number', F\sum()],
120
+    ['product', 'List -> Number', F\product()],
121
+    ['min', 'Number -> Number -> Number', F\min()],
122
+    ['minBy', 'Function -> Any -> Any -> Any', F\minBy()],
123
+    ['max', 'Number -> Number -> Number', F\max()],
124
+    ['maxBy', 'Function -> Any -> Any -> Any', F\maxBy()],
125 125
 
126 126
 ]);
Please login to merge, or discard this patch.