@@ -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 | } |
@@ -142,10 +142,10 @@ discard block |
||
| 142 | 142 | public function pluck($property) |
| 143 | 143 | { |
| 144 | 144 | $plucked = array_map( |
| 145 | - function ($value) use ($property) { |
|
| 145 | + function($value) use ($property) { |
|
| 146 | 146 | return $this->get($property, null, $value); |
| 147 | 147 | }, |
| 148 | - (array)$this->array |
|
| 148 | + (array) $this->array |
|
| 149 | 149 | ); |
| 150 | 150 | |
| 151 | 151 | return $plucked; |
@@ -168,47 +168,47 @@ discard block |
||
| 168 | 168 | } |
| 169 | 169 | |
| 170 | 170 | $ops = array( |
| 171 | - 'eq' => function ($item, $prop, $value) { |
|
| 171 | + 'eq' => function($item, $prop, $value) { |
|
| 172 | 172 | return $item[$prop] === $value; |
| 173 | 173 | }, |
| 174 | - 'gt' => function ($item, $prop, $value) { |
|
| 174 | + 'gt' => function($item, $prop, $value) { |
|
| 175 | 175 | return $item[$prop] > $value; |
| 176 | 176 | }, |
| 177 | - 'gte' => function ($item, $prop, $value) { |
|
| 177 | + 'gte' => function($item, $prop, $value) { |
|
| 178 | 178 | return $item[$prop] >= $value; |
| 179 | 179 | }, |
| 180 | - 'lt' => function ($item, $prop, $value) { |
|
| 180 | + 'lt' => function($item, $prop, $value) { |
|
| 181 | 181 | return $item[$prop] < $value; |
| 182 | 182 | }, |
| 183 | - 'lte' => function ($item, $prop, $value) { |
|
| 183 | + 'lte' => function($item, $prop, $value) { |
|
| 184 | 184 | return $item[$prop] <= $value; |
| 185 | 185 | }, |
| 186 | - 'ne' => function ($item, $prop, $value) { |
|
| 186 | + 'ne' => function($item, $prop, $value) { |
|
| 187 | 187 | return $item[$prop] !== $value; |
| 188 | 188 | }, |
| 189 | - 'contains' => function ($item, $prop, $value) { |
|
| 190 | - return in_array($item[$prop], (array)$value, true); |
|
| 189 | + 'contains' => function($item, $prop, $value) { |
|
| 190 | + return in_array($item[$prop], (array) $value, true); |
|
| 191 | 191 | }, |
| 192 | - 'notContains' => function ($item, $prop, $value) { |
|
| 193 | - return !in_array($item[$prop], (array)$value, true); |
|
| 192 | + 'notContains' => function($item, $prop, $value) { |
|
| 193 | + return !in_array($item[$prop], (array) $value, true); |
|
| 194 | 194 | }, |
| 195 | - 'newer' => function ($item, $prop, $value) { |
|
| 195 | + 'newer' => function($item, $prop, $value) { |
|
| 196 | 196 | return strtotime($item[$prop]) > strtotime($value); |
| 197 | 197 | }, |
| 198 | - 'older' => function ($item, $prop, $value) { |
|
| 198 | + 'older' => function($item, $prop, $value) { |
|
| 199 | 199 | return strtotime($item[$prop]) < strtotime($value); |
| 200 | 200 | }, |
| 201 | 201 | ); |
| 202 | 202 | |
| 203 | 203 | $result = array_values( |
| 204 | 204 | array_filter( |
| 205 | - (array)$this->array, function ($item) use ( |
|
| 205 | + (array) $this->array, function($item) use ( |
|
| 206 | 206 | $property, |
| 207 | 207 | $value, |
| 208 | 208 | $ops, |
| 209 | 209 | $comparisonOp |
| 210 | 210 | ) { |
| 211 | - $item = (array)$item; |
|
| 211 | + $item = (array) $item; |
|
| 212 | 212 | $item[$property] = $this->get($property, array(), $item); |
| 213 | 213 | |
| 214 | 214 | return $ops[$comparisonOp]($item, $property, $value); |
@@ -244,7 +244,7 @@ discard block |
||
| 244 | 244 | */ |
| 245 | 245 | public function keys() |
| 246 | 246 | { |
| 247 | - return array_keys((array)$this->array); |
|
| 247 | + return array_keys((array) $this->array); |
|
| 248 | 248 | } |
| 249 | 249 | |
| 250 | 250 | /** |
@@ -254,7 +254,7 @@ discard block |
||
| 254 | 254 | */ |
| 255 | 255 | public function values() |
| 256 | 256 | { |
| 257 | - return array_values((array)$this->array); |
|
| 257 | + return array_values((array) $this->array); |
|
| 258 | 258 | } |
| 259 | 259 | |
| 260 | 260 | //////////////////////////////////////////////////////////////////// |
@@ -288,7 +288,7 @@ discard block |
||
| 288 | 288 | */ |
| 289 | 289 | public function sort($sorter = null, $direction = 'asc') |
| 290 | 290 | { |
| 291 | - $array = (array)$this->array; |
|
| 291 | + $array = (array) $this->array; |
|
| 292 | 292 | |
| 293 | 293 | // Get correct PHP constant for direction |
| 294 | 294 | $direction = strtolower($direction); |
@@ -304,7 +304,7 @@ discard block |
||
| 304 | 304 | $arrayy = new Arrayy($array); |
| 305 | 305 | |
| 306 | 306 | $results = $arrayy->each( |
| 307 | - function ($value) use ($sorter) { |
|
| 307 | + function($value) use ($sorter) { |
|
| 308 | 308 | return is_callable($sorter) ? $sorter($value) : $this->get($sorter, null, $value); |
| 309 | 309 | } |
| 310 | 310 | ); |
@@ -328,7 +328,7 @@ discard block |
||
| 328 | 328 | */ |
| 329 | 329 | public function group($grouper, $saveKeys = false) |
| 330 | 330 | { |
| 331 | - $array = (array)$this->array; |
|
| 331 | + $array = (array) $this->array; |
|
| 332 | 332 | $result = array(); |
| 333 | 333 | |
| 334 | 334 | // Iterate over values, group by property/results from closure |