@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | || |
| 33 | 33 | (is_object($array) && method_exists($array, '__toString')) |
| 34 | 34 | ) { |
| 35 | - $array = (array)$array; |
|
| 35 | + $array = (array) $array; |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | if (!is_array($array)) { |
@@ -179,7 +179,7 @@ discard block |
||
| 179 | 179 | } |
| 180 | 180 | } |
| 181 | 181 | |
| 182 | - return (array)$this->array; |
|
| 182 | + return (array) $this->array; |
|
| 183 | 183 | } |
| 184 | 184 | |
| 185 | 185 | /** |
@@ -228,7 +228,7 @@ discard block |
||
| 228 | 228 | } |
| 229 | 229 | } |
| 230 | 230 | |
| 231 | - return self::create((array)$return); |
|
| 231 | + return self::create((array) $return); |
|
| 232 | 232 | } |
| 233 | 233 | |
| 234 | 234 | /** |
@@ -248,7 +248,7 @@ discard block |
||
| 248 | 248 | $return = array($key); |
| 249 | 249 | } |
| 250 | 250 | |
| 251 | - return self::create((array)$return); |
|
| 251 | + return self::create((array) $return); |
|
| 252 | 252 | } |
| 253 | 253 | |
| 254 | 254 | /** |
@@ -420,8 +420,8 @@ discard block |
||
| 420 | 420 | public function clean() |
| 421 | 421 | { |
| 422 | 422 | return $this->filter( |
| 423 | - function ($value) { |
|
| 424 | - return (bool)$value; |
|
| 423 | + function($value) { |
|
| 424 | + return (bool) $value; |
|
| 425 | 425 | } |
| 426 | 426 | ); |
| 427 | 427 | } |
@@ -487,7 +487,7 @@ discard block |
||
| 487 | 487 | $array = array_splice($this->array, 0, $take, true); |
| 488 | 488 | } |
| 489 | 489 | |
| 490 | - return self::create((array)$array); |
|
| 490 | + return self::create((array) $array); |
|
| 491 | 491 | } |
| 492 | 492 | |
| 493 | 493 | /** |
@@ -500,7 +500,7 @@ discard block |
||
| 500 | 500 | public function last($take = null) |
| 501 | 501 | { |
| 502 | 502 | if ($take === null) { |
| 503 | - $array = self::create((array)array_pop($this->array)); |
|
| 503 | + $array = self::create((array) array_pop($this->array)); |
|
| 504 | 504 | } else { |
| 505 | 505 | $array = $this->rest(-$take); |
| 506 | 506 | } |
@@ -682,7 +682,7 @@ discard block |
||
| 682 | 682 | $array[$key] = $replacement; |
| 683 | 683 | } |
| 684 | 684 | |
| 685 | - return self::create((array)$array); |
|
| 685 | + return self::create((array) $array); |
|
| 686 | 686 | } |
| 687 | 687 | |
| 688 | 688 | /** |
@@ -696,12 +696,12 @@ discard block |
||
| 696 | 696 | public function replaceValues($search, $replacement = '') |
| 697 | 697 | { |
| 698 | 698 | $array = $this->each( |
| 699 | - function ($value) use ($search, $replacement) { |
|
| 699 | + function($value) use ($search, $replacement) { |
|
| 700 | 700 | return UTF8::str_replace($search, $replacement, $value); |
| 701 | 701 | } |
| 702 | 702 | ); |
| 703 | 703 | |
| 704 | - return self::create((array)$array); |
|
| 704 | + return self::create((array) $array); |
|
| 705 | 705 | } |
| 706 | 706 | |
| 707 | 707 | /** |
@@ -951,7 +951,7 @@ discard block |
||
| 951 | 951 | { |
| 952 | 952 | $this->array = array_reduce( |
| 953 | 953 | $this->array, |
| 954 | - function ($resultArray, $value) { |
|
| 954 | + function($resultArray, $value) { |
|
| 955 | 955 | if (in_array($value, $resultArray, true) === false) { |
| 956 | 956 | $resultArray[] = $value; |
| 957 | 957 | } |
@@ -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 |