@@ -23,7 +23,7 @@ |
||
23 | 23 | * |
24 | 24 | * @return Collection |
25 | 25 | */ |
26 | - public static function create($items = [], $className = 'Novactive\Collection\Collection') |
|
26 | + public static function create($items = [ ], $className = 'Novactive\Collection\Collection') |
|
27 | 27 | { |
28 | 28 | $options = null; |
29 | 29 | if (getenv('DEBUG_COLLECTION_CLASS') && getenv('DEBUG_COLLECTION_CLASS') != '') { |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | * |
34 | 34 | * @param array $items |
35 | 35 | */ |
36 | - public function __construct(array $items = []) |
|
36 | + public function __construct(array $items = [ ]) |
|
37 | 37 | { |
38 | 38 | $this->items = $items; |
39 | 39 | $this->rewind(); |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | */ |
58 | 58 | public function set($key, $value) |
59 | 59 | { |
60 | - $this->items[$key] = $value; |
|
60 | + $this->items[ $key ] = $value; |
|
61 | 61 | |
62 | 62 | return $this; |
63 | 63 | } |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | public function get($key, $default = null) |
74 | 74 | { |
75 | 75 | if ($this->containsKey($key)) { |
76 | - return $this->items[$key]; |
|
76 | + return $this->items[ $key ]; |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | return $default; |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | */ |
146 | 146 | public function containsKey($key) |
147 | 147 | { |
148 | - return isset($this->items[$key]) || array_key_exists($key, $this->items); |
|
148 | + return isset($this->items[ $key ]) || array_key_exists($key, $this->items); |
|
149 | 149 | } |
150 | 150 | |
151 | 151 | /** |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | */ |
172 | 172 | public function add($item) |
173 | 173 | { |
174 | - $this->items[] = $item; |
|
174 | + $this->items[ ] = $item; |
|
175 | 175 | |
176 | 176 | return $this; |
177 | 177 | } |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | */ |
204 | 204 | public function clear() |
205 | 205 | { |
206 | - $this->items = []; |
|
206 | + $this->items = [ ]; |
|
207 | 207 | |
208 | 208 | return $this; |
209 | 209 | } |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | */ |
218 | 218 | public function remove($key) |
219 | 219 | { |
220 | - unset($this->items[$key]); |
|
220 | + unset($this->items[ $key ]); |
|
221 | 221 | |
222 | 222 | return $this; |
223 | 223 | } |
@@ -234,8 +234,8 @@ discard block |
||
234 | 234 | if (!$this->containsKey($key)) { |
235 | 235 | return null; |
236 | 236 | } |
237 | - $removed = $this->items[$key]; |
|
238 | - unset($this->items[$key]); |
|
237 | + $removed = $this->items[ $key ]; |
|
238 | + unset($this->items[ $key ]); |
|
239 | 239 | |
240 | 240 | return $removed; |
241 | 241 | } |
@@ -728,8 +728,8 @@ discard block |
||
728 | 728 | $collection = Factory::create($items); |
729 | 729 | |
730 | 730 | return $this->map( |
731 | - function ($value, $key, $index) use ($collection) { |
|
732 | - return [$value, $collection->atIndex($index)]; |
|
731 | + function($value, $key, $index) use ($collection) { |
|
732 | + return [ $value, $collection->atIndex($index) ]; |
|
733 | 733 | } |
734 | 734 | ); |
735 | 735 | } |
@@ -840,7 +840,7 @@ discard block |
||
840 | 840 | } |
841 | 841 | |
842 | 842 | return $this->prune( |
843 | - function ($value, $key, $index) use ($offset, $length) { |
|
843 | + function($value, $key, $index) use ($offset, $length) { |
|
844 | 844 | return !(($index >= $offset) && ($index < $offset + $length)); |
845 | 845 | } |
846 | 846 | ); |
@@ -21,13 +21,17 @@ discard block |
||
21 | 21 | /** |
22 | 22 | * Explode the selector to get ranges. |
23 | 23 | * |
24 | - * @param $selector |
|
24 | + * @param string $selector |
|
25 | 25 | * |
26 | 26 | * @return Collection |
27 | 27 | */ |
28 | 28 | protected function getRanges($selector) |
29 | 29 | { |
30 | 30 | return Factory::create(explode(';', $selector))->map( |
31 | + |
|
32 | + /** |
|
33 | + * @param string $range |
|
34 | + */ |
|
31 | 35 | function ($range) { |
32 | 36 | if ($separator = $this->dotDotSeparator($range) != false) { |
33 | 37 | return Factory::create([substr($range, 0, $separator), substr($range, $separator + 2)]); |
@@ -73,7 +77,7 @@ discard block |
||
73 | 77 | |
74 | 78 | /** |
75 | 79 | * @param Collection $parameters |
76 | - * @param Collection $collectionl |
|
80 | + * @param Collection $collection |
|
77 | 81 | */ |
78 | 82 | public function convert(Collection $parameters, Collection $collection) |
79 | 83 | { |
@@ -28,14 +28,14 @@ discard block |
||
28 | 28 | protected function getRanges($selector) |
29 | 29 | { |
30 | 30 | return Factory::create(explode(';', $selector))->map( |
31 | - function ($range) { |
|
31 | + function($range) { |
|
32 | 32 | if ($separator = $this->dotDotSeparator($range) != false) { |
33 | - return Factory::create([substr($range, 0, $separator), substr($range, $separator + 2)]); |
|
33 | + return Factory::create([ substr($range, 0, $separator), substr($range, $separator + 2) ]); |
|
34 | 34 | } |
35 | 35 | if (($separator = $this->columnSeparator($range) != false) || |
36 | 36 | ($separator = $this->dashSeparator($range) != false) |
37 | 37 | ) { |
38 | - return Factory::create([substr($range, 0, $separator), substr($range, $separator + 1)]); |
|
38 | + return Factory::create([ substr($range, 0, $separator), substr($range, $separator + 1) ]); |
|
39 | 39 | } |
40 | 40 | if ($separator = $this->commaSeparator($range) != false) { |
41 | 41 | return Factory::create( |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | } |
48 | 48 | |
49 | 49 | // just a number here |
50 | - return Factory::create([$range, $range]); |
|
50 | + return Factory::create([ $range, $range ]); |
|
51 | 51 | } |
52 | 52 | ); |
53 | 53 | } |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | public function supports(Collection $parameters) |
61 | 61 | { |
62 | 62 | return $parameters->assert( |
63 | - function ($param) { |
|
63 | + function($param) { |
|
64 | 64 | if (is_array($param) && count($param) == 2) { |
65 | 65 | return true; |
66 | 66 | } |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | { |
80 | 80 | $newCollection = Factory::create(); |
81 | 81 | $selector = $parameters->map( |
82 | - function ($param) { |
|
82 | + function($param) { |
|
83 | 83 | if ((is_array($param) && count($param) == 2)) { |
84 | 84 | return implode(':', $param); |
85 | 85 | } |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | )->implode(';'); |
90 | 90 | |
91 | 91 | return $this->getRanges($selector)->reduce( |
92 | - function (Collection $accumulator, Collection $range) use ($collection) { |
|
92 | + function(Collection $accumulator, Collection $range) use ($collection) { |
|
93 | 93 | $from = $range->first(); |
94 | 94 | $to = $range->last(); |
95 | 95 | if ($to >= $from) { |