Completed
Push — master ( bff53a...713d54 )
by Amine
05:06 queued 02:10
created
src/functions.php 2 patches
Doc Comments   -2 removed lines patch added patch discarded remove patch
@@ -64,8 +64,6 @@
 block discarded – undo
64 64
  * ```
65 65
  *
66 66
  * @signature (*... -> a) -> [*] -> a
67
- * @param  callable $fn
68
- * @param  array    $args
69 67
  * @return mixed
70 68
  */
71 69
 function apply() {
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -91,8 +91,9 @@
 block discarded – undo
91 91
  */
92 92
 function pipe() {
93 93
     $fns = func_get_args();
94
-    if(count($fns) < 1)
95
-        throw new InvalidArgument("pipe() requires at least one argument");
94
+    if(count($fns) < 1) {
95
+            throw new InvalidArgument("pipe() requires at least one argument");
96
+    }
96 97
     return curry(function () use ($fns) {
97 98
         $result = _apply(array_shift($fns), func_get_args());
98 99
         foreach ($fns as $fn) {
Please login to merge, or discard this patch.
src/math.php 1 patch
Doc Comments   -10 removed lines patch added patch discarded remove patch
@@ -11,8 +11,6 @@  discard block
 block discarded – undo
11 11
  * ```
12 12
  *
13 13
  * @signature Number -> Number -> Number
14
- * @param  int|float $x
15
- * @param  int|float $y
16 14
  * @return int|float
17 15
  */
18 16
 function plus() {
@@ -29,8 +27,6 @@  discard block
 block discarded – undo
29 27
  * ```
30 28
  *
31 29
  * @signature Number -> Number -> Number
32
- * @param  int|float $x
33
- * @param  int|float $y
34 30
  * @return int|float
35 31
  */
36 32
 function minus() {
@@ -63,8 +59,6 @@  discard block
 block discarded – undo
63 59
  * ```
64 60
  *
65 61
  * @signature Number -> Number -> Number
66
- * @param  int|float $x
67
- * @param  int|float $y
68 62
  * @return int|float
69 63
  */
70 64
 function multiply() {
@@ -81,8 +75,6 @@  discard block
 block discarded – undo
81 75
  * ```
82 76
  *
83 77
  * @signature Number -> Number -> Number
84
- * @param  int|float $x
85
- * @param  int|float $y
86 78
  * @return int|float
87 79
  */
88 80
 function divide() {
@@ -99,8 +91,6 @@  discard block
 block discarded – undo
99 91
  * ```
100 92
  *
101 93
  * @signature Number -> Number -> Number
102
- * @param  int|float $x
103
- * @param  int|float $y
104 94
  * @return int|float
105 95
  */
106 96
 function modulo() {
Please login to merge, or discard this patch.
src/operators.php 1 patch
Doc Comments   -20 removed lines patch added patch discarded remove patch
@@ -8,8 +8,6 @@  discard block
 block discarded – undo
8 8
  * Returns `$a && $b`.
9 9
  *
10 10
  * @signature Boolean -> Boolean -> Boolean
11
- * @param  bool $a
12
- * @param  bool $b
13 11
  * @return bool
14 12
  */
15 13
 function and_() {
@@ -22,8 +20,6 @@  discard block
 block discarded – undo
22 20
  * Returns `$a || $b`.
23 21
  *
24 22
  * @signature Boolean -> Boolean -> Boolean
25
- * @param  bool $a
26
- * @param  bool $b
27 23
  * @return bool
28 24
  */
29 25
 function or_() {
@@ -47,8 +43,6 @@  discard block
 block discarded – undo
47 43
  * Returns `$x == $y`.
48 44
  *
49 45
  * @signature * -> * -> Boolean
50
- * @param  mixed $a
51
- * @param  mixed $b
52 46
  * @return bool
53 47
  */
54 48
 function eq() {
@@ -61,8 +55,6 @@  discard block
 block discarded – undo
61 55
  * Returns `$x != $y`.
62 56
  *
63 57
  * @signature * -> * -> Boolean
64
- * @param  mixed $a
65
- * @param  mixed $b
66 58
  * @return bool
67 59
  */
68 60
 function notEq() {
@@ -75,8 +67,6 @@  discard block
 block discarded – undo
75 67
  * Returns `$x === $y`.
76 68
  *
77 69
  * @signature * -> * -> Boolean
78
- * @param  mixed $a
79
- * @param  mixed $b
80 70
  * @return bool
81 71
  */
82 72
 function eqq() {
@@ -89,8 +79,6 @@  discard block
 block discarded – undo
89 79
  * Returns `$x !== $y`.
90 80
  *
91 81
  * @signature * -> * -> Boolean
92
- * @param  mixed $a
93
- * @param  mixed $b
94 82
  * @return bool
95 83
  */
96 84
 function notEqq() {
@@ -103,8 +91,6 @@  discard block
 block discarded – undo
103 91
  * Returns `$x < $y`.
104 92
  *
105 93
  * @signature * -> * -> Boolean
106
- * @param  mixed $a
107
- * @param  mixed $b
108 94
  * @return bool
109 95
  */
110 96
 function lt() {
@@ -117,8 +103,6 @@  discard block
 block discarded – undo
117 103
  * Returns `$x <= $y`.
118 104
  *
119 105
  * @signature * -> * -> Boolean
120
- * @param  mixed $a
121
- * @param  mixed $b
122 106
  * @return bool
123 107
  */
124 108
 function lte() {
@@ -131,8 +115,6 @@  discard block
 block discarded – undo
131 115
  * Returns `$x > $y`.
132 116
  *
133 117
  * @signature * -> * -> Boolean
134
- * @param  mixed $a
135
- * @param  mixed $b
136 118
  * @return bool
137 119
  */
138 120
 function gt() {
@@ -145,8 +127,6 @@  discard block
 block discarded – undo
145 127
  * Returns `$x >= $y`.
146 128
  *
147 129
  * @signature * -> * -> Boolean
148
- * @param  mixed $a
149
- * @param  mixed $b
150 130
  * @return bool
151 131
  */
152 132
 function gte() {
Please login to merge, or discard this patch.
src/Stream.php 2 patches
Doc Comments   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -94,6 +94,7 @@  discard block
 block discarded – undo
94 94
      *
95 95
      * @param  mixed $data
96 96
      * @param  array $operations
97
+     * @param boolean $type
97 98
      * @return Stream
98 99
      */
99 100
     protected static function with ($data, $operations, $type)
@@ -414,7 +415,6 @@  discard block
 block discarded – undo
414 415
      *
415 416
      * @signature Stream(a) -> (String, ...) -> Stream(*)
416 417
      * @param  string $method
417
-     * @param  mixed|null $args...
418 418
      * @return Stream
419 419
      */
420 420
     public function call ($method)
@@ -468,7 +468,6 @@  discard block
 block discarded – undo
468 468
      *
469 469
      * @signature Stream(a) -> (String, ...) -> Stream(a)
470 470
      * @param  string $method
471
-     * @param  mixed|null $args...
472 471
      * @return Stream
473 472
      */
474 473
     public function run ($method)
Please login to merge, or discard this patch.
Braces   +18 added lines, -12 removed lines patch added patch discarded remove patch
@@ -84,8 +84,9 @@  discard block
 block discarded – undo
84 84
     public static function of ($data)
85 85
     {
86 86
         $data = func_get_args();
87
-        if (count($data) == 1)
88
-            $data = $data[0];
87
+        if (count($data) == 1) {
88
+                    $data = $data[0];
89
+        }
89 90
         return new Stream($data, [], type($data));
90 91
     }
91 92
 
@@ -122,8 +123,9 @@  discard block
 block discarded – undo
122 123
      */
123 124
     protected static function execute ($operations, $data)
124 125
     {
125
-        if (length($operations) == 0)
126
-            return $data;
126
+        if (length($operations) == 0) {
127
+                    return $data;
128
+        }
127 129
         $operations = apply('Tarsana\\Functional\\pipe', map(function($operation){
128 130
             if ($operation['name'] == 'apply') {
129 131
                 return $operation['args'];
@@ -234,8 +236,9 @@  discard block
 block discarded – undo
234 236
      */
235 237
     public function get ()
236 238
     {
237
-        if ($this->type == 'Error')
238
-            return $this->data;
239
+        if ($this->type == 'Error') {
240
+                    return $this->data;
241
+        }
239 242
         return Stream::execute($this->operations, $this->data);
240 243
     }
241 244
 
@@ -421,11 +424,13 @@  discard block
 block discarded – undo
421 424
     {
422 425
         $args = tail(func_get_args());
423 426
         return Stream::apply('apply', function($data) use($method, $args) {
424
-            if (is_callable([$data, $method]))
425
-                return call_user_func_array([$data, $method], $args);
427
+            if (is_callable([$data, $method])) {
428
+                            return call_user_func_array([$data, $method], $args);
429
+            }
426 430
             $text = toString($data);
427
-            if (method_exists($data, $method))
428
-                return Error::of("Method '{$method}' of {$text} is not accessible");
431
+            if (method_exists($data, $method)) {
432
+                            return Error::of("Method '{$method}' of {$text} is not accessible");
433
+            }
429 434
             return Error::of("Method '{$method}' of {$text} is not found");
430 435
         }, $this);
431 436
     }
@@ -480,8 +485,9 @@  discard block
 block discarded – undo
480 485
                 return $data;
481 486
             }
482 487
             $text = toString($data);
483
-            if (method_exists($data, $method))
484
-                return Error::of("Method '{$method}' of {$text} is not accessible");
488
+            if (method_exists($data, $method)) {
489
+                            return Error::of("Method '{$method}' of {$text} is not accessible");
490
+            }
485 491
             return Error::of("Method '{$method}' of {$text} is not found");
486 492
         }, $this);
487 493
     }
Please login to merge, or discard this patch.
src/string.php 1 patch
Doc Comments   -25 removed lines patch added patch discarded remove patch
@@ -11,8 +11,6 @@  discard block
 block discarded – undo
11 11
  * ```
12 12
  *
13 13
  * @signature String -> String -> [String]
14
- * @param string $delimiter
15
- * @param string $string
16 14
  * @return array
17 15
  */
18 16
 function split() {
@@ -27,8 +25,6 @@  discard block
 block discarded – undo
27 25
  * ```
28 26
  *
29 27
  * @signature String -> [String] -> String
30
- * @param string $glue
31
- * @param array $pieces
32 28
  * @return string
33 29
  */
34 30
 function join() {
@@ -48,9 +44,6 @@  discard block
 block discarded – undo
48 44
  * ```
49 45
  *
50 46
  * @signature String|[String] -> String -> String|[String] -> String
51
- * @param  string $search
52
- * @param  string $replacement
53
- * @param  string $string
54 47
  * @return string
55 48
  */
56 49
 function replace() {
@@ -66,9 +59,6 @@  discard block
 block discarded – undo
66 59
  * ```
67 60
  *
68 61
  * @signature String -> String -> String -> String
69
- * @param  string $pattern
70
- * @param  string $replacement
71
- * @param  string $string
72 62
  * @return string
73 63
  */
74 64
 function regReplace() {
@@ -131,8 +121,6 @@  discard block
 block discarded – undo
131 121
  * ```
132 122
  *
133 123
  * @signature String -> String -> String
134
- * @param  string $delimiter
135
- * @param  string $string
136 124
  * @return string
137 125
  */
138 126
 function snakeCase() {
@@ -158,8 +146,6 @@  discard block
 block discarded – undo
158 146
  * ```
159 147
  *
160 148
  * @signature String -> String -> Boolean
161
- * @param  string $token
162
- * @param  string $string
163 149
  * @return bool
164 150
  */
165 151
 function startsWith() {
@@ -181,8 +167,6 @@  discard block
 block discarded – undo
181 167
  * ```
182 168
  *
183 169
  * @signature String -> String -> Boolean
184
- * @param  string $token
185
- * @param  string $string
186 170
  * @return bool
187 171
  */
188 172
 function endsWith() {
@@ -204,8 +188,6 @@  discard block
 block discarded – undo
204 188
  * ```
205 189
  *
206 190
  * @signature String -> String -> Boolean
207
- * @param  string $pattern
208
- * @param  string $string
209 191
  * @return bool
210 192
  */
211 193
 function test() {
@@ -225,8 +207,6 @@  discard block
 block discarded – undo
225 207
  * ```
226 208
  *
227 209
  * @signature String -> String -> [String]
228
- * @param  string $pattern
229
- * @param  string $string
230 210
  * @return array
231 211
  */
232 212
 function match() {
@@ -247,8 +227,6 @@  discard block
 block discarded – undo
247 227
  * ```
248 228
  *
249 229
  * @signature String -> String -> Number
250
- * @param  string $token
251
- * @param  string $text
252 230
  * @return int
253 231
  */
254 232
 function occurences() {
@@ -271,9 +249,6 @@  discard block
 block discarded – undo
271 249
  * ```
272 250
  *
273 251
  * @signature String -> String -> String -> [String]
274
- * @param  string $surrounders
275
- * @param  string $separator
276
- * @param  sring $text
277 252
  * @return array
278 253
  */
279 254
 function chunks() {
Please login to merge, or discard this patch.
src/Error.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -37,8 +37,9 @@
 block discarded – undo
37 37
      */
38 38
     protected function __construct ($message, Error $error = null)
39 39
     {
40
-        if (null != $error)
41
-            $message = $error->message() . ' -> ' . $message;
40
+        if (null != $error) {
41
+                    $message = $error->message() . ' -> ' . $message;
42
+        }
42 43
         $this->message = $message;
43 44
     }
44 45
 
Please login to merge, or discard this patch.
src/common.php 1 patch
Braces   +33 added lines, -13 removed lines patch added patch discarded remove patch
@@ -27,22 +27,42 @@
 block discarded – undo
27 27
  * @return string
28 28
  */
29 29
 function type($data) {
30
-    if (null === $data) return 'Null';
31
-    if (true === $data || false === $data) return 'Boolean';
32
-    if ($data instanceof Error) return 'Error';
33
-    if ($data instanceof Stream) return 'Stream';
34
-    if (is_callable($data)) return 'Function';
35
-    if (is_resource($data)) return 'Resource';
36
-    if (is_string($data)) return 'String';
37
-    if (is_integer($data) || is_float($data)) return 'Number';
30
+    if (null === $data) {
31
+        return 'Null';
32
+    }
33
+    if (true === $data || false === $data) {
34
+        return 'Boolean';
35
+    }
36
+    if ($data instanceof Error) {
37
+        return 'Error';
38
+    }
39
+    if ($data instanceof Stream) {
40
+        return 'Stream';
41
+    }
42
+    if (is_callable($data)) {
43
+        return 'Function';
44
+    }
45
+    if (is_resource($data)) {
46
+        return 'Resource';
47
+    }
48
+    if (is_string($data)) {
49
+        return 'String';
50
+    }
51
+    if (is_integer($data) || is_float($data)) {
52
+        return 'Number';
53
+    }
38 54
     if (is_array($data)) {
39
-        if (all('is_numeric', array_keys($data)))
40
-            return 'List';
41
-        if (all('is_string', array_keys($data)))
42
-            return 'ArrayObject';
55
+        if (all('is_numeric', array_keys($data))) {
56
+                    return 'List';
57
+        }
58
+        if (all('is_string', array_keys($data))) {
59
+                    return 'ArrayObject';
60
+        }
43 61
         return 'Array';
44 62
     }
45
-    if (is_object($data)) return 'Object';
63
+    if (is_object($data)) {
64
+        return 'Object';
65
+    }
46 66
     return 'Unknown';
47 67
 }
48 68
 
Please login to merge, or discard this patch.
generate-docs.php 1 patch
Braces   +16 added lines, -11 removed lines patch added patch discarded remove patch
@@ -67,13 +67,16 @@  discard block
 block discarded – undo
67 67
 // Extracts the type of a block
68 68
 // Object -> String
69 69
 function typeOf($data) {
70
-    if (isset($data->ctx->type))
71
-        return $data->ctx->type;
72
-    if (F\length(tags('var', $data)) > 0)
73
-        return 'attr';
74
-    if (F\length(tags('return', $data)) > 0)
75
-        return 'method';
76
-}
70
+    if (isset($data->ctx->type)) {
71
+            return $data->ctx->type;
72
+    }
73
+    if (F\length(tags('var', $data)) > 0) {
74
+            return 'attr';
75
+    }
76
+    if (F\length(tags('return', $data)) > 0) {
77
+            return 'method';
78
+    }
79
+    }
77 80
 
78 81
 // Extract keywords
79 82
 // Object -> [String]
@@ -82,8 +85,9 @@  discard block
 block discarded – undo
82 85
         return [];
83 86
     }
84 87
     $size = strpos($data->code, '(');
85
-    if ($size === false)
86
-        $size = strlen($data->code);
88
+    if ($size === false) {
89
+            $size = strlen($data->code);
90
+    }
87 91
     $keywords = F\pipe(
88 92
         F\take($size),
89 93
         F\split(' '),
@@ -124,8 +128,9 @@  discard block
 block discarded – undo
124 128
 // Get a markdown code block
125 129
 // String -> String -> String
126 130
 function code($lang, $text) {
127
-    if(trim($text) == '')
128
-        return '';
131
+    if(trim($text) == '') {
132
+            return '';
133
+    }
129 134
     return "```{$lang}\n{$text}\n```";
130 135
 }
131 136
 
Please login to merge, or discard this patch.
src/object.php 1 patch
Doc Comments   -4 removed lines patch added patch discarded remove patch
@@ -19,8 +19,6 @@  discard block
 block discarded – undo
19 19
  * ```
20 20
  *
21 21
  * @signature String|Number -> [key => *] -> *
22
- * @param  string $name
23
- * @param  array $array
24 22
  * @return mixed
25 23
  */
26 24
 function value() {
@@ -52,8 +50,6 @@  discard block
 block discarded – undo
52 50
  * ```
53 51
  *
54 52
  * @signature String|Number -> [key => *] -> Boolean
55
- * @param  string $name
56
- * @param  array $array
57 53
  * @return mixed
58 54
  */
59 55
 function has() {
Please login to merge, or discard this patch.