Completed
Push — master ( 26de6b...bf1e9f )
by Alexander
06:02
created
YaLinqo/EnumerableGeneration.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -16,11 +16,11 @@  discard block
 block discarded – undo
16 16
      * @return Enumerable Endless list of items repeating the source sequence.
17 17
      * @package YaLinqo\Generation
18 18
      */
19
-    public static function cycle ($source)
19
+    public static function cycle($source)
20 20
     {
21 21
         $source = self::from($source);
22 22
 
23
-        return new self(function () use ($source) {
23
+        return new self(function() use ($source) {
24 24
             $isEmpty = true;
25 25
             while (true) {
26 26
                 foreach ($source as $v) {
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
      * @return Enumerable
40 40
      * @package YaLinqo\Generation
41 41
      */
42
-    public static function emptyEnum ()
42
+    public static function emptyEnum()
43 43
     {
44 44
         return new self(new \EmptyIterator, false);
45 45
     }
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
      * @return Enumerable
61 61
      * @package YaLinqo\Generation
62 62
      */
63
-    public static function from ($source)
63
+    public static function from($source)
64 64
     {
65 65
         $it = null;
66 66
         if ($source instanceof Enumerable)
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
         throw new \InvalidArgumentException('source must be array or Traversable.');
80 80
     }
81 81
 
82
-    private static function fromTraversable ($source)
82
+    private static function fromTraversable($source)
83 83
     {
84 84
         foreach ($source as $k => $v)
85 85
             yield $k => $v;
@@ -96,12 +96,12 @@  discard block
 block discarded – undo
96 96
      * @return Enumerable
97 97
      * @package YaLinqo\Generation
98 98
      */
99
-    public static function generate ($funcValue, $seedValue = null, $funcKey = null, $seedKey = null)
99
+    public static function generate($funcValue, $seedValue = null, $funcKey = null, $seedKey = null)
100 100
     {
101 101
         $funcValue = Utils::createLambda($funcValue, 'v,k');
102 102
         $funcKey = Utils::createLambda($funcKey, 'v,k', false);
103 103
 
104
-        return new self(function () use ($funcValue, $funcKey, $seedValue, $seedKey) {
104
+        return new self(function() use ($funcValue, $funcKey, $seedValue, $seedKey) {
105 105
             $key = $seedKey === null ? ($funcKey ? $funcKey($seedValue, $seedKey) : 0) : $seedKey;
106 106
             $value = $seedValue === null ? $funcValue($seedValue, $seedKey) : $seedValue;
107 107
             yield $key => $value;
@@ -123,9 +123,9 @@  discard block
 block discarded – undo
123 123
      * @return Enumerable
124 124
      * @package YaLinqo\Generation
125 125
      */
126
-    public static function toInfinity ($start = 0, $step = 1)
126
+    public static function toInfinity($start = 0, $step = 1)
127 127
     {
128
-        return new self(function () use ($start, $step) {
128
+        return new self(function() use ($start, $step) {
129 129
             $value = $start - $step;
130 130
             while (true)
131 131
                 yield $value += $step;
@@ -142,9 +142,9 @@  discard block
 block discarded – undo
142 142
      * @see preg_match_all
143 143
      * @package YaLinqo\Generation
144 144
      */
145
-    public static function matches ($subject, $pattern, $flags = PREG_SET_ORDER)
145
+    public static function matches($subject, $pattern, $flags = PREG_SET_ORDER)
146 146
     {
147
-        return new self(function () use ($subject, $pattern, $flags) {
147
+        return new self(function() use ($subject, $pattern, $flags) {
148 148
             preg_match_all($pattern, $subject, $matches, $flags);
149 149
             return $matches !== false ? self::from($matches)->getIterator() : self::emptyEnum();
150 150
         });
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
      * @return Enumerable
159 159
      * @package YaLinqo\Generation
160 160
      */
161
-    public static function toNegativeInfinity ($start = 0, $step = 1)
161
+    public static function toNegativeInfinity($start = 0, $step = 1)
162 162
     {
163 163
         return self::toInfinity($start, -$step);
164 164
     }
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
      * @return Enumerable Observable sequence containing the single specified element.
171 171
      * @package YaLinqo\Generation
172 172
      */
173
-    public static function returnEnum ($element)
173
+    public static function returnEnum($element)
174 174
     {
175 175
         return self::repeat($element, 1);
176 176
     }
@@ -186,11 +186,11 @@  discard block
 block discarded – undo
186 186
      * @return Enumerable A sequence that contains a range of integral numbers.
187 187
      * @package YaLinqo\Generation
188 188
      */
189
-    public static function range ($start, $count, $step = 1)
189
+    public static function range($start, $count, $step = 1)
190 190
     {
191 191
         if ($count <= 0)
192 192
             return self::emptyEnum();
193
-        return new self(function () use ($start, $count, $step) {
193
+        return new self(function() use ($start, $count, $step) {
194 194
             $value = $start - $step;
195 195
             while ($count-- > 0)
196 196
                 yield $value += $step;
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
      * @return Enumerable A sequence that contains a range of integral numbers.
209 209
      * @package YaLinqo\Generation
210 210
      */
211
-    public static function rangeDown ($start, $count, $step = 1)
211
+    public static function rangeDown($start, $count, $step = 1)
212 212
     {
213 213
         return self::range($start, $count, -$step);
214 214
     }
@@ -225,11 +225,11 @@  discard block
 block discarded – undo
225 225
      * @return Enumerable A sequence that contains a range of integral numbers.
226 226
      * @package YaLinqo\Generation
227 227
      */
228
-    public static function rangeTo ($start, $end, $step = 1)
228
+    public static function rangeTo($start, $end, $step = 1)
229 229
     {
230 230
         if ($step <= 0)
231 231
             throw new \InvalidArgumentException(Errors::STEP_NEGATIVE);
232
-        return new self(function () use ($start, $end, $step) {
232
+        return new self(function() use ($start, $end, $step) {
233 233
             if ($start <= $end) {
234 234
                 for ($i = $start; $i < $end; $i += $step)
235 235
                     yield $i;
@@ -254,11 +254,11 @@  discard block
 block discarded – undo
254 254
      * @return Enumerable A sequence that contains a repeated value.
255 255
      * @package YaLinqo\Generation
256 256
      */
257
-    public static function repeat ($element, $count = null)
257
+    public static function repeat($element, $count = null)
258 258
     {
259 259
         if ($count < 0)
260 260
             throw new \InvalidArgumentException(Errors::COUNT_LESS_THAN_ZERO);
261
-        return new self(function () use ($element, $count) {
261
+        return new self(function() use ($element, $count) {
262 262
             for ($i = 0; $i < $count || $count === null; $i++)
263 263
                 yield $element;
264 264
         });
@@ -274,7 +274,7 @@  discard block
 block discarded – undo
274 274
      * @see preg_split
275 275
      * @package YaLinqo\Generation
276 276
      */
277
-    public static function split ($subject, $pattern, $flags = 0)
277
+    public static function split($subject, $pattern, $flags = 0)
278 278
     {
279 279
         return new self(
280 280
             new \ArrayIterator(preg_split($pattern, $subject, -1, $flags)),
Please login to merge, or discard this patch.