@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | public function has($key) |
30 | 30 | { |
31 | 31 | // Generate unique string to use as marker. |
32 | - $unFound = (string)uniqid('arrayy', true); |
|
32 | + $unFound = (string) uniqid('arrayy', true); |
|
33 | 33 | |
34 | 34 | return $this->get($key, $unFound) !== $unFound; |
35 | 35 | } |
@@ -151,47 +151,47 @@ discard block |
||
151 | 151 | } |
152 | 152 | |
153 | 153 | $ops = array( |
154 | - 'eq' => function ($item, $prop, $value) { |
|
154 | + 'eq' => function($item, $prop, $value) { |
|
155 | 155 | return $item[$prop] === $value; |
156 | 156 | }, |
157 | - 'gt' => function ($item, $prop, $value) { |
|
157 | + 'gt' => function($item, $prop, $value) { |
|
158 | 158 | return $item[$prop] > $value; |
159 | 159 | }, |
160 | - 'gte' => function ($item, $prop, $value) { |
|
160 | + 'gte' => function($item, $prop, $value) { |
|
161 | 161 | return $item[$prop] >= $value; |
162 | 162 | }, |
163 | - 'lt' => function ($item, $prop, $value) { |
|
163 | + 'lt' => function($item, $prop, $value) { |
|
164 | 164 | return $item[$prop] < $value; |
165 | 165 | }, |
166 | - 'lte' => function ($item, $prop, $value) { |
|
166 | + 'lte' => function($item, $prop, $value) { |
|
167 | 167 | return $item[$prop] <= $value; |
168 | 168 | }, |
169 | - 'ne' => function ($item, $prop, $value) { |
|
169 | + 'ne' => function($item, $prop, $value) { |
|
170 | 170 | return $item[$prop] !== $value; |
171 | 171 | }, |
172 | - 'contains' => function ($item, $prop, $value) { |
|
173 | - return in_array($item[$prop], (array)$value, true); |
|
172 | + 'contains' => function($item, $prop, $value) { |
|
173 | + return in_array($item[$prop], (array) $value, true); |
|
174 | 174 | }, |
175 | - 'notContains' => function ($item, $prop, $value) { |
|
176 | - return !in_array($item[$prop], (array)$value, true); |
|
175 | + 'notContains' => function($item, $prop, $value) { |
|
176 | + return !in_array($item[$prop], (array) $value, true); |
|
177 | 177 | }, |
178 | - 'newer' => function ($item, $prop, $value) { |
|
178 | + 'newer' => function($item, $prop, $value) { |
|
179 | 179 | return strtotime($item[$prop]) > strtotime($value); |
180 | 180 | }, |
181 | - 'older' => function ($item, $prop, $value) { |
|
181 | + 'older' => function($item, $prop, $value) { |
|
182 | 182 | return strtotime($item[$prop]) < strtotime($value); |
183 | 183 | }, |
184 | 184 | ); |
185 | 185 | |
186 | 186 | $result = array_values( |
187 | 187 | array_filter( |
188 | - (array)$this->array, function ($item) use ( |
|
188 | + (array) $this->array, function($item) use ( |
|
189 | 189 | $property, |
190 | 190 | $value, |
191 | 191 | $ops, |
192 | 192 | $comparisonOp |
193 | 193 | ) { |
194 | - $item = (array)$item; |
|
194 | + $item = (array) $item; |
|
195 | 195 | $item[$property] = $this->get($property, array(), $item); |
196 | 196 | |
197 | 197 | return $ops[$comparisonOp]($item, $property, $value); |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | */ |
230 | 230 | public function keys() |
231 | 231 | { |
232 | - $return = array_keys((array)$this->array); |
|
232 | + $return = array_keys((array) $this->array); |
|
233 | 233 | |
234 | 234 | return Arrayy::create($return); |
235 | 235 | } |
@@ -241,7 +241,7 @@ discard block |
||
241 | 241 | */ |
242 | 242 | public function values() |
243 | 243 | { |
244 | - $return = array_values((array)$this->array); |
|
244 | + $return = array_values((array) $this->array); |
|
245 | 245 | |
246 | 246 | return Arrayy::create($return); |
247 | 247 | } |
@@ -277,7 +277,7 @@ discard block |
||
277 | 277 | */ |
278 | 278 | public function sort($sorter = null, $direction = 'asc') |
279 | 279 | { |
280 | - $array = (array)$this->array; |
|
280 | + $array = (array) $this->array; |
|
281 | 281 | |
282 | 282 | // Get correct PHP constant for direction |
283 | 283 | $direction = strtolower($direction); |
@@ -293,7 +293,7 @@ discard block |
||
293 | 293 | $arrayy = new Arrayy($array); |
294 | 294 | |
295 | 295 | $results = $arrayy->each( |
296 | - function ($value) use ($sorter) { |
|
296 | + function($value) use ($sorter) { |
|
297 | 297 | return is_callable($sorter) ? $sorter($value) : $this->get($sorter, null, $value); |
298 | 298 | } |
299 | 299 | ); |
@@ -317,7 +317,7 @@ discard block |
||
317 | 317 | */ |
318 | 318 | public function group($grouper, $saveKeys = false) |
319 | 319 | { |
320 | - $array = (array)$this->array; |
|
320 | + $array = (array) $this->array; |
|
321 | 321 | $result = array(); |
322 | 322 | |
323 | 323 | // Iterate over values, group by property/results from closure |