@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | || |
| 29 | 29 | (is_object($array) && method_exists($array, '__toString')) |
| 30 | 30 | ) { |
| 31 | - $array = (array)$array; |
|
| 31 | + $array = (array) $array; |
|
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | if (!is_array($array)) { |
@@ -190,7 +190,7 @@ discard block |
||
| 190 | 190 | } |
| 191 | 191 | } |
| 192 | 192 | |
| 193 | - return (array)$this->array; |
|
| 193 | + return (array) $this->array; |
|
| 194 | 194 | } |
| 195 | 195 | |
| 196 | 196 | /** |
@@ -240,7 +240,7 @@ discard block |
||
| 240 | 240 | // trim all string in the array |
| 241 | 241 | array_walk( |
| 242 | 242 | $array, |
| 243 | - function (&$val) { |
|
| 243 | + function(&$val) { |
|
| 244 | 244 | if (is_string($val)) { |
| 245 | 245 | $val = trim($val); |
| 246 | 246 | } |
@@ -288,7 +288,7 @@ discard block |
||
| 288 | 288 | } |
| 289 | 289 | } |
| 290 | 290 | |
| 291 | - return static::create((array)$return); |
|
| 291 | + return static::create((array) $return); |
|
| 292 | 292 | } |
| 293 | 293 | |
| 294 | 294 | /** |
@@ -308,7 +308,7 @@ discard block |
||
| 308 | 308 | $return = array($key); |
| 309 | 309 | } |
| 310 | 310 | |
| 311 | - return static::create((array)$return); |
|
| 311 | + return static::create((array) $return); |
|
| 312 | 312 | } |
| 313 | 313 | |
| 314 | 314 | /** |
@@ -364,7 +364,7 @@ discard block |
||
| 364 | 364 | return false; |
| 365 | 365 | } |
| 366 | 366 | |
| 367 | - return (bool)count(array_filter(array_keys($this->array), 'is_string')); |
|
| 367 | + return (bool) count(array_filter(array_keys($this->array), 'is_string')); |
|
| 368 | 368 | } |
| 369 | 369 | |
| 370 | 370 | /** |
@@ -504,8 +504,8 @@ discard block |
||
| 504 | 504 | public function clean() |
| 505 | 505 | { |
| 506 | 506 | return $this->filter( |
| 507 | - function ($value) { |
|
| 508 | - return (bool)$value; |
|
| 507 | + function($value) { |
|
| 508 | + return (bool) $value; |
|
| 509 | 509 | } |
| 510 | 510 | ); |
| 511 | 511 | } |
@@ -524,7 +524,7 @@ discard block |
||
| 524 | 524 | } |
| 525 | 525 | |
| 526 | 526 | if ($take === null) { |
| 527 | - return static::create((array)$this->array[array_rand($this->array)]); |
|
| 527 | + return static::create((array) $this->array[array_rand($this->array)]); |
|
| 528 | 528 | } |
| 529 | 529 | |
| 530 | 530 | shuffle($this->array); |
@@ -599,7 +599,7 @@ discard block |
||
| 599 | 599 | $array = array_splice($this->array, 0, $take, true); |
| 600 | 600 | } |
| 601 | 601 | |
| 602 | - return static::create((array)$array); |
|
| 602 | + return static::create((array) $array); |
|
| 603 | 603 | } |
| 604 | 604 | |
| 605 | 605 | /** |
@@ -612,7 +612,7 @@ discard block |
||
| 612 | 612 | public function last($take = null) |
| 613 | 613 | { |
| 614 | 614 | if ($take === null) { |
| 615 | - $array = static::create((array)array_pop($this->array)); |
|
| 615 | + $array = static::create((array) array_pop($this->array)); |
|
| 616 | 616 | } else { |
| 617 | 617 | $array = $this->rest(-$take); |
| 618 | 618 | } |
@@ -785,12 +785,12 @@ discard block |
||
| 785 | 785 | public function replaceValues($search, $replacement = '') |
| 786 | 786 | { |
| 787 | 787 | $array = $this->each( |
| 788 | - function ($value) use ($search, $replacement) { |
|
| 788 | + function($value) use ($search, $replacement) { |
|
| 789 | 789 | return UTF8::str_replace($search, $replacement, $value); |
| 790 | 790 | } |
| 791 | 791 | ); |
| 792 | 792 | |
| 793 | - return static::create((array)$array); |
|
| 793 | + return static::create((array) $array); |
|
| 794 | 794 | } |
| 795 | 795 | |
| 796 | 796 | /** |
@@ -1184,7 +1184,7 @@ discard block |
||
| 1184 | 1184 | */ |
| 1185 | 1185 | public function sorter($sorter = null, $direction = SORT_ASC, $strategy = SORT_REGULAR) |
| 1186 | 1186 | { |
| 1187 | - $array = (array)$this->array; |
|
| 1187 | + $array = (array) $this->array; |
|
| 1188 | 1188 | $direction = $this->getDirection($direction); |
| 1189 | 1189 | |
| 1190 | 1190 | // Transform all values into their results. |
@@ -1193,7 +1193,7 @@ discard block |
||
| 1193 | 1193 | |
| 1194 | 1194 | $that = $this; |
| 1195 | 1195 | $results = $arrayy->each( |
| 1196 | - function ($value) use ($sorter, $that) { |
|
| 1196 | + function($value) use ($sorter, $that) { |
|
| 1197 | 1197 | return is_callable($sorter) ? $sorter($value) : $that->get($sorter, null, $value); |
| 1198 | 1198 | } |
| 1199 | 1199 | ); |
@@ -1293,7 +1293,7 @@ discard block |
||
| 1293 | 1293 | { |
| 1294 | 1294 | $this->array = array_reduce( |
| 1295 | 1295 | $this->array, |
| 1296 | - function ($resultArray, $value) { |
|
| 1296 | + function($resultArray, $value) { |
|
| 1297 | 1297 | if (in_array($value, $resultArray, true) === false) { |
| 1298 | 1298 | $resultArray[] = $value; |
| 1299 | 1299 | } |
@@ -1209,7 +1209,7 @@ |
||
| 1209 | 1209 | |
| 1210 | 1210 | /** |
| 1211 | 1211 | * @param array &$elements |
| 1212 | - * @param int|string $direction |
|
| 1212 | + * @param integer $direction |
|
| 1213 | 1213 | * @param int $strategy |
| 1214 | 1214 | * @param bool $keepKeys |
| 1215 | 1215 | */ |
@@ -151,34 +151,34 @@ 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) { |
|
| 172 | + 'contains' => function($item, $prop, $value) { |
|
| 173 | 173 | return in_array($item[$prop], (array) $value, true); |
| 174 | 174 | }, |
| 175 | - 'notContains' => function ($item, $prop, $value) { |
|
| 175 | + 'notContains' => function($item, $prop, $value) { |
|
| 176 | 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 | ); |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | $result = array_values( |
| 187 | 187 | array_filter( |
| 188 | 188 | (array) $this->array, |
| 189 | - function ($item) use ( |
|
| 189 | + function($item) use ( |
|
| 190 | 190 | $property, |
| 191 | 191 | $value, |
| 192 | 192 | $ops, |