@@ -5,8 +5,7 @@ discard block |
||
| 5 | 5 | use Closure; |
| 6 | 6 | use BadMethodCallException; |
| 7 | 7 | |
| 8 | -trait Macroable |
|
| 9 | -{ |
|
| 8 | +trait Macroable { |
|
| 10 | 9 | /** |
| 11 | 10 | * The registered string macros. |
| 12 | 11 | * |
@@ -21,8 +20,7 @@ discard block |
||
| 21 | 20 | * @param callable $macro |
| 22 | 21 | * @return void |
| 23 | 22 | */ |
| 24 | - public static function macro($name, callable $macro) |
|
| 25 | - { |
|
| 23 | + public static function macro($name, callable $macro) { |
|
| 26 | 24 | static::$macros[$name] = $macro; |
| 27 | 25 | } |
| 28 | 26 | |
@@ -32,8 +30,7 @@ discard block |
||
| 32 | 30 | * @param string $name |
| 33 | 31 | * @return bool |
| 34 | 32 | */ |
| 35 | - public static function hasMacro($name) |
|
| 36 | - { |
|
| 33 | + public static function hasMacro($name) { |
|
| 37 | 34 | return isset(static::$macros[$name]); |
| 38 | 35 | } |
| 39 | 36 | |
@@ -46,8 +43,7 @@ discard block |
||
| 46 | 43 | * |
| 47 | 44 | * @throws \BadMethodCallException |
| 48 | 45 | */ |
| 49 | - public static function __callStatic($method, $parameters) |
|
| 50 | - { |
|
| 46 | + public static function __callStatic($method, $parameters) { |
|
| 51 | 47 | if (! static::hasMacro($method)) { |
| 52 | 48 | throw new BadMethodCallException("Method {$method} does not exist."); |
| 53 | 49 | } |
@@ -68,8 +64,7 @@ discard block |
||
| 68 | 64 | * |
| 69 | 65 | * @throws \BadMethodCallException |
| 70 | 66 | */ |
| 71 | - public function __call($method, $parameters) |
|
| 72 | - { |
|
| 67 | + public function __call($method, $parameters) { |
|
| 73 | 68 | if (! static::hasMacro($method)) { |
| 74 | 69 | throw new BadMethodCallException("Method {$method} does not exist."); |
| 75 | 70 | } |
@@ -5,8 +5,7 @@ discard block |
||
| 5 | 5 | /** |
| 6 | 6 | * @mixin \Illuminate\Support\Collection |
| 7 | 7 | */ |
| 8 | -class HigherOrderCollectionProxy |
|
| 9 | -{ |
|
| 8 | +class HigherOrderCollectionProxy { |
|
| 10 | 9 | /** |
| 11 | 10 | * The collection being operated on. |
| 12 | 11 | * |
@@ -28,8 +27,7 @@ discard block |
||
| 28 | 27 | * @param string $method |
| 29 | 28 | * @return void |
| 30 | 29 | */ |
| 31 | - public function __construct(Collection $collection, $method) |
|
| 32 | - { |
|
| 30 | + public function __construct(Collection $collection, $method) { |
|
| 33 | 31 | $this->method = $method; |
| 34 | 32 | $this->collection = $collection; |
| 35 | 33 | } |
@@ -40,8 +38,7 @@ discard block |
||
| 40 | 38 | * @param string $key |
| 41 | 39 | * @return mixed |
| 42 | 40 | */ |
| 43 | - public function __get($key) |
|
| 44 | - { |
|
| 41 | + public function __get($key) { |
|
| 45 | 42 | return $this->collection->{$this->method}(function ($value) use ($key) { |
| 46 | 43 | return is_array($value) ? $value[$key] : $value->{$key}; |
| 47 | 44 | }); |
@@ -54,8 +51,7 @@ discard block |
||
| 54 | 51 | * @param array $parameters |
| 55 | 52 | * @return mixed |
| 56 | 53 | */ |
| 57 | - public function __call($method, $parameters) |
|
| 58 | - { |
|
| 54 | + public function __call($method, $parameters) { |
|
| 59 | 55 | return $this->collection->{$this->method}(function ($value) use ($method, $parameters) { |
| 60 | 56 | return $value->{$method}(...$parameters); |
| 61 | 57 | }); |
@@ -41,8 +41,7 @@ discard block |
||
| 41 | 41 | * @param mixed $items |
| 42 | 42 | * @return void |
| 43 | 43 | */ |
| 44 | - public function __construct($items = []) |
|
| 45 | - { |
|
| 44 | + public function __construct($items = []) { |
|
| 46 | 45 | $this->items = $this->getArrayableItems($items); |
| 47 | 46 | } |
| 48 | 47 | |
@@ -52,8 +51,7 @@ discard block |
||
| 52 | 51 | * @param mixed $items |
| 53 | 52 | * @return static |
| 54 | 53 | */ |
| 55 | - public static function make($items = []) |
|
| 56 | - { |
|
| 54 | + public static function make($items = []) { |
|
| 57 | 55 | return new static($items); |
| 58 | 56 | } |
| 59 | 57 | |
@@ -64,8 +62,7 @@ discard block |
||
| 64 | 62 | * @param callable $callback |
| 65 | 63 | * @return static |
| 66 | 64 | */ |
| 67 | - public static function times($number, callable $callback = null) |
|
| 68 | - { |
|
| 65 | + public static function times($number, callable $callback = null) { |
|
| 69 | 66 | if ($number < 1) { |
| 70 | 67 | return new static; |
| 71 | 68 | } |
@@ -82,8 +79,7 @@ discard block |
||
| 82 | 79 | * |
| 83 | 80 | * @return array |
| 84 | 81 | */ |
| 85 | - public function all() |
|
| 86 | - { |
|
| 82 | + public function all() { |
|
| 87 | 83 | return $this->items; |
| 88 | 84 | } |
| 89 | 85 | |
@@ -93,8 +89,7 @@ discard block |
||
| 93 | 89 | * @param callable|string|null $callback |
| 94 | 90 | * @return mixed |
| 95 | 91 | */ |
| 96 | - public function avg($callback = null) |
|
| 97 | - { |
|
| 92 | + public function avg($callback = null) { |
|
| 98 | 93 | if ($count = $this->count()) { |
| 99 | 94 | return $this->sum($callback) / $count; |
| 100 | 95 | } |
@@ -106,8 +101,7 @@ discard block |
||
| 106 | 101 | * @param callable|string|null $callback |
| 107 | 102 | * @return mixed |
| 108 | 103 | */ |
| 109 | - public function average($callback = null) |
|
| 110 | - { |
|
| 104 | + public function average($callback = null) { |
|
| 111 | 105 | return $this->avg($callback); |
| 112 | 106 | } |
| 113 | 107 | |
@@ -117,8 +111,7 @@ discard block |
||
| 117 | 111 | * @param null $key |
| 118 | 112 | * @return mixed |
| 119 | 113 | */ |
| 120 | - public function median($key = null) |
|
| 121 | - { |
|
| 114 | + public function median($key = null) { |
|
| 122 | 115 | $count = $this->count(); |
| 123 | 116 | |
| 124 | 117 | if ($count == 0) { |
@@ -145,8 +138,7 @@ discard block |
||
| 145 | 138 | * @param mixed $key |
| 146 | 139 | * @return array|null |
| 147 | 140 | */ |
| 148 | - public function mode($key = null) |
|
| 149 | - { |
|
| 141 | + public function mode($key = null) { |
|
| 150 | 142 | $count = $this->count(); |
| 151 | 143 | |
| 152 | 144 | if ($count == 0) { |
@@ -175,8 +167,7 @@ discard block |
||
| 175 | 167 | * |
| 176 | 168 | * @return static |
| 177 | 169 | */ |
| 178 | - public function collapse() |
|
| 179 | - { |
|
| 170 | + public function collapse() { |
|
| 180 | 171 | return new static(Arr::collapse($this->items)); |
| 181 | 172 | } |
| 182 | 173 | |
@@ -188,8 +179,7 @@ discard block |
||
| 188 | 179 | * @param mixed $value |
| 189 | 180 | * @return bool |
| 190 | 181 | */ |
| 191 | - public function contains($key, $operator = null, $value = null) |
|
| 192 | - { |
|
| 182 | + public function contains($key, $operator = null, $value = null) { |
|
| 193 | 183 | if (func_num_args() == 1) { |
| 194 | 184 | if ($this->useAsCallable($key)) { |
| 195 | 185 | return ! is_null($this->first($key)); |
@@ -214,8 +204,7 @@ discard block |
||
| 214 | 204 | * @param mixed $value |
| 215 | 205 | * @return bool |
| 216 | 206 | */ |
| 217 | - public function containsStrict($key, $value = null) |
|
| 218 | - { |
|
| 207 | + public function containsStrict($key, $value = null) { |
|
| 219 | 208 | if (func_num_args() == 2) { |
| 220 | 209 | return $this->contains(function ($item) use ($key, $value) { |
| 221 | 210 | return data_get($item, $key) === $value; |
@@ -235,8 +224,7 @@ discard block |
||
| 235 | 224 | * @param mixed ...$lists |
| 236 | 225 | * @return static |
| 237 | 226 | */ |
| 238 | - public function crossJoin(...$lists) |
|
| 239 | - { |
|
| 227 | + public function crossJoin(...$lists) { |
|
| 240 | 228 | return new static(Arr::crossJoin( |
| 241 | 229 | $this->items, ...array_map([$this, 'getArrayableItems'], $lists) |
| 242 | 230 | )); |
@@ -248,8 +236,7 @@ discard block |
||
| 248 | 236 | * @param mixed $items |
| 249 | 237 | * @return static |
| 250 | 238 | */ |
| 251 | - public function diff($items) |
|
| 252 | - { |
|
| 239 | + public function diff($items) { |
|
| 253 | 240 | return new static(array_diff($this->items, $this->getArrayableItems($items))); |
| 254 | 241 | } |
| 255 | 242 | |
@@ -259,8 +246,7 @@ discard block |
||
| 259 | 246 | * @param mixed $items |
| 260 | 247 | * @return static |
| 261 | 248 | */ |
| 262 | - public function diffAssoc($items) |
|
| 263 | - { |
|
| 249 | + public function diffAssoc($items) { |
|
| 264 | 250 | return new static(array_diff_assoc($this->items, $this->getArrayableItems($items))); |
| 265 | 251 | } |
| 266 | 252 | |
@@ -270,8 +256,7 @@ discard block |
||
| 270 | 256 | * @param mixed $items |
| 271 | 257 | * @return static |
| 272 | 258 | */ |
| 273 | - public function diffKeys($items) |
|
| 274 | - { |
|
| 259 | + public function diffKeys($items) { |
|
| 275 | 260 | return new static(array_diff_key($this->items, $this->getArrayableItems($items))); |
| 276 | 261 | } |
| 277 | 262 | |
@@ -281,8 +266,7 @@ discard block |
||
| 281 | 266 | * @param callable $callback |
| 282 | 267 | * @return $this |
| 283 | 268 | */ |
| 284 | - public function each(callable $callback) |
|
| 285 | - { |
|
| 269 | + public function each(callable $callback) { |
|
| 286 | 270 | foreach ($this->items as $key => $item) { |
| 287 | 271 | if ($callback($item, $key) === false) { |
| 288 | 272 | break; |
@@ -298,8 +282,7 @@ discard block |
||
| 298 | 282 | * @param callable $callback |
| 299 | 283 | * @return static |
| 300 | 284 | */ |
| 301 | - public function eachSpread(callable $callback) |
|
| 302 | - { |
|
| 285 | + public function eachSpread(callable $callback) { |
|
| 303 | 286 | return $this->each(function ($chunk) use ($callback) { |
| 304 | 287 | return $callback(...$chunk); |
| 305 | 288 | }); |
@@ -313,8 +296,7 @@ discard block |
||
| 313 | 296 | * @param mixed $value |
| 314 | 297 | * @return bool |
| 315 | 298 | */ |
| 316 | - public function every($key, $operator = null, $value = null) |
|
| 317 | - { |
|
| 299 | + public function every($key, $operator = null, $value = null) { |
|
| 318 | 300 | if (func_num_args() == 1) { |
| 319 | 301 | $callback = $this->valueRetriever($key); |
| 320 | 302 | |
@@ -342,8 +324,7 @@ discard block |
||
| 342 | 324 | * @param mixed $keys |
| 343 | 325 | * @return static |
| 344 | 326 | */ |
| 345 | - public function except($keys) |
|
| 346 | - { |
|
| 327 | + public function except($keys) { |
|
| 347 | 328 | $keys = is_array($keys) ? $keys : func_get_args(); |
| 348 | 329 | |
| 349 | 330 | return new static(Arr::except($this->items, $keys)); |
@@ -355,8 +336,7 @@ discard block |
||
| 355 | 336 | * @param callable|null $callback |
| 356 | 337 | * @return static |
| 357 | 338 | */ |
| 358 | - public function filter(callable $callback = null) |
|
| 359 | - { |
|
| 339 | + public function filter(callable $callback = null) { |
|
| 360 | 340 | if ($callback) { |
| 361 | 341 | return new static(Arr::where($this->items, $callback)); |
| 362 | 342 | } |
@@ -372,8 +352,7 @@ discard block |
||
| 372 | 352 | * @param callable $default |
| 373 | 353 | * @return mixed |
| 374 | 354 | */ |
| 375 | - public function when($value, callable $callback, callable $default = null) |
|
| 376 | - { |
|
| 355 | + public function when($value, callable $callback, callable $default = null) { |
|
| 377 | 356 | if ($value) { |
| 378 | 357 | return $callback($this); |
| 379 | 358 | } elseif ($default) { |
@@ -391,8 +370,7 @@ discard block |
||
| 391 | 370 | * @param callable $default |
| 392 | 371 | * @return mixed |
| 393 | 372 | */ |
| 394 | - public function unless($value, callable $callback, callable $default = null) |
|
| 395 | - { |
|
| 373 | + public function unless($value, callable $callback, callable $default = null) { |
|
| 396 | 374 | return $this->when(! $value, $callback, $default); |
| 397 | 375 | } |
| 398 | 376 | |
@@ -404,8 +382,7 @@ discard block |
||
| 404 | 382 | * @param mixed $value |
| 405 | 383 | * @return static |
| 406 | 384 | */ |
| 407 | - public function where($key, $operator, $value = null) |
|
| 408 | - { |
|
| 385 | + public function where($key, $operator, $value = null) { |
|
| 409 | 386 | if (func_num_args() == 2) { |
| 410 | 387 | $value = $operator; |
| 411 | 388 | |
@@ -423,8 +400,7 @@ discard block |
||
| 423 | 400 | * @param mixed $value |
| 424 | 401 | * @return \Closure |
| 425 | 402 | */ |
| 426 | - protected function operatorForWhere($key, $operator, $value) |
|
| 427 | - { |
|
| 403 | + protected function operatorForWhere($key, $operator, $value) { |
|
| 428 | 404 | return function ($item) use ($key, $operator, $value) { |
| 429 | 405 | $retrieved = data_get($item, $key); |
| 430 | 406 | |
@@ -451,8 +427,7 @@ discard block |
||
| 451 | 427 | * @param mixed $value |
| 452 | 428 | * @return static |
| 453 | 429 | */ |
| 454 | - public function whereStrict($key, $value) |
|
| 455 | - { |
|
| 430 | + public function whereStrict($key, $value) { |
|
| 456 | 431 | return $this->where($key, '===', $value); |
| 457 | 432 | } |
| 458 | 433 | |
@@ -464,8 +439,7 @@ discard block |
||
| 464 | 439 | * @param bool $strict |
| 465 | 440 | * @return static |
| 466 | 441 | */ |
| 467 | - public function whereIn($key, $values, $strict = false) |
|
| 468 | - { |
|
| 442 | + public function whereIn($key, $values, $strict = false) { |
|
| 469 | 443 | $values = $this->getArrayableItems($values); |
| 470 | 444 | |
| 471 | 445 | return $this->filter(function ($item) use ($key, $values, $strict) { |
@@ -480,8 +454,7 @@ discard block |
||
| 480 | 454 | * @param mixed $values |
| 481 | 455 | * @return static |
| 482 | 456 | */ |
| 483 | - public function whereInStrict($key, $values) |
|
| 484 | - { |
|
| 457 | + public function whereInStrict($key, $values) { |
|
| 485 | 458 | return $this->whereIn($key, $values, true); |
| 486 | 459 | } |
| 487 | 460 | |
@@ -493,8 +466,7 @@ discard block |
||
| 493 | 466 | * @param bool $strict |
| 494 | 467 | * @return static |
| 495 | 468 | */ |
| 496 | - public function whereNotIn($key, $values, $strict = false) |
|
| 497 | - { |
|
| 469 | + public function whereNotIn($key, $values, $strict = false) { |
|
| 498 | 470 | $values = $this->getArrayableItems($values); |
| 499 | 471 | |
| 500 | 472 | return $this->reject(function ($item) use ($key, $values, $strict) { |
@@ -509,8 +481,7 @@ discard block |
||
| 509 | 481 | * @param mixed $values |
| 510 | 482 | * @return static |
| 511 | 483 | */ |
| 512 | - public function whereNotInStrict($key, $values) |
|
| 513 | - { |
|
| 484 | + public function whereNotInStrict($key, $values) { |
|
| 514 | 485 | return $this->whereNotIn($key, $values, true); |
| 515 | 486 | } |
| 516 | 487 | |
@@ -521,8 +492,7 @@ discard block |
||
| 521 | 492 | * @param mixed $default |
| 522 | 493 | * @return mixed |
| 523 | 494 | */ |
| 524 | - public function first(callable $callback = null, $default = null) |
|
| 525 | - { |
|
| 495 | + public function first(callable $callback = null, $default = null) { |
|
| 526 | 496 | return Arr::first($this->items, $callback, $default); |
| 527 | 497 | } |
| 528 | 498 | |
@@ -532,8 +502,7 @@ discard block |
||
| 532 | 502 | * @param int $depth |
| 533 | 503 | * @return static |
| 534 | 504 | */ |
| 535 | - public function flatten($depth = INF) |
|
| 536 | - { |
|
| 505 | + public function flatten($depth = INF) { |
|
| 537 | 506 | return new static(Arr::flatten($this->items, $depth)); |
| 538 | 507 | } |
| 539 | 508 | |
@@ -542,8 +511,7 @@ discard block |
||
| 542 | 511 | * |
| 543 | 512 | * @return static |
| 544 | 513 | */ |
| 545 | - public function flip() |
|
| 546 | - { |
|
| 514 | + public function flip() { |
|
| 547 | 515 | return new static(array_flip($this->items)); |
| 548 | 516 | } |
| 549 | 517 | |
@@ -553,8 +521,7 @@ discard block |
||
| 553 | 521 | * @param string|array $keys |
| 554 | 522 | * @return $this |
| 555 | 523 | */ |
| 556 | - public function forget($keys) |
|
| 557 | - { |
|
| 524 | + public function forget($keys) { |
|
| 558 | 525 | foreach ((array) $keys as $key) { |
| 559 | 526 | $this->offsetUnset($key); |
| 560 | 527 | } |
@@ -569,8 +536,7 @@ discard block |
||
| 569 | 536 | * @param mixed $default |
| 570 | 537 | * @return mixed |
| 571 | 538 | */ |
| 572 | - public function get($key, $default = null) |
|
| 573 | - { |
|
| 539 | + public function get($key, $default = null) { |
|
| 574 | 540 | if ($this->offsetExists($key)) { |
| 575 | 541 | return $this->items[$key]; |
| 576 | 542 | } |
@@ -585,8 +551,7 @@ discard block |
||
| 585 | 551 | * @param bool $preserveKeys |
| 586 | 552 | * @return static |
| 587 | 553 | */ |
| 588 | - public function groupBy($groupBy, $preserveKeys = false) |
|
| 589 | - { |
|
| 554 | + public function groupBy($groupBy, $preserveKeys = false) { |
|
| 590 | 555 | $groupBy = $this->valueRetriever($groupBy); |
| 591 | 556 | |
| 592 | 557 | $results = []; |
@@ -618,8 +583,7 @@ discard block |
||
| 618 | 583 | * @param callable|string $keyBy |
| 619 | 584 | * @return static |
| 620 | 585 | */ |
| 621 | - public function keyBy($keyBy) |
|
| 622 | - { |
|
| 586 | + public function keyBy($keyBy) { |
|
| 623 | 587 | $keyBy = $this->valueRetriever($keyBy); |
| 624 | 588 | |
| 625 | 589 | $results = []; |
@@ -643,8 +607,7 @@ discard block |
||
| 643 | 607 | * @param mixed $key |
| 644 | 608 | * @return bool |
| 645 | 609 | */ |
| 646 | - public function has($key) |
|
| 647 | - { |
|
| 610 | + public function has($key) { |
|
| 648 | 611 | return $this->offsetExists($key); |
| 649 | 612 | } |
| 650 | 613 | |
@@ -655,8 +618,7 @@ discard block |
||
| 655 | 618 | * @param string $glue |
| 656 | 619 | * @return string |
| 657 | 620 | */ |
| 658 | - public function implode($value, $glue = null) |
|
| 659 | - { |
|
| 621 | + public function implode($value, $glue = null) { |
|
| 660 | 622 | $first = $this->first(); |
| 661 | 623 | |
| 662 | 624 | if (is_array($first) || is_object($first)) { |
@@ -672,8 +634,7 @@ discard block |
||
| 672 | 634 | * @param mixed $items |
| 673 | 635 | * @return static |
| 674 | 636 | */ |
| 675 | - public function intersect($items) |
|
| 676 | - { |
|
| 637 | + public function intersect($items) { |
|
| 677 | 638 | return new static(array_intersect($this->items, $this->getArrayableItems($items))); |
| 678 | 639 | } |
| 679 | 640 | |
@@ -683,8 +644,7 @@ discard block |
||
| 683 | 644 | * @param mixed $items |
| 684 | 645 | * @return static |
| 685 | 646 | */ |
| 686 | - public function intersectKey($items) |
|
| 687 | - { |
|
| 647 | + public function intersectKey($items) { |
|
| 688 | 648 | return new static(array_intersect_key($this->items, $this->getArrayableItems($items))); |
| 689 | 649 | } |
| 690 | 650 | |
@@ -693,8 +653,7 @@ discard block |
||
| 693 | 653 | * |
| 694 | 654 | * @return bool |
| 695 | 655 | */ |
| 696 | - public function isEmpty() |
|
| 697 | - { |
|
| 656 | + public function isEmpty() { |
|
| 698 | 657 | return empty($this->items); |
| 699 | 658 | } |
| 700 | 659 | |
@@ -703,8 +662,7 @@ discard block |
||
| 703 | 662 | * |
| 704 | 663 | * @return bool |
| 705 | 664 | */ |
| 706 | - public function isNotEmpty() |
|
| 707 | - { |
|
| 665 | + public function isNotEmpty() { |
|
| 708 | 666 | return ! $this->isEmpty(); |
| 709 | 667 | } |
| 710 | 668 | |
@@ -714,8 +672,7 @@ discard block |
||
| 714 | 672 | * @param mixed $value |
| 715 | 673 | * @return bool |
| 716 | 674 | */ |
| 717 | - protected function useAsCallable($value) |
|
| 718 | - { |
|
| 675 | + protected function useAsCallable($value) { |
|
| 719 | 676 | return ! is_string($value) && is_callable($value); |
| 720 | 677 | } |
| 721 | 678 | |
@@ -724,8 +681,7 @@ discard block |
||
| 724 | 681 | * |
| 725 | 682 | * @return static |
| 726 | 683 | */ |
| 727 | - public function keys() |
|
| 728 | - { |
|
| 684 | + public function keys() { |
|
| 729 | 685 | return new static(array_keys($this->items)); |
| 730 | 686 | } |
| 731 | 687 | |
@@ -736,8 +692,7 @@ discard block |
||
| 736 | 692 | * @param mixed $default |
| 737 | 693 | * @return mixed |
| 738 | 694 | */ |
| 739 | - public function last(callable $callback = null, $default = null) |
|
| 740 | - { |
|
| 695 | + public function last(callable $callback = null, $default = null) { |
|
| 741 | 696 | return Arr::last($this->items, $callback, $default); |
| 742 | 697 | } |
| 743 | 698 | |
@@ -748,8 +703,7 @@ discard block |
||
| 748 | 703 | * @param string|null $key |
| 749 | 704 | * @return static |
| 750 | 705 | */ |
| 751 | - public function pluck($value, $key = null) |
|
| 752 | - { |
|
| 706 | + public function pluck($value, $key = null) { |
|
| 753 | 707 | return new static(Arr::pluck($this->items, $value, $key)); |
| 754 | 708 | } |
| 755 | 709 | |
@@ -759,8 +713,7 @@ discard block |
||
| 759 | 713 | * @param callable $callback |
| 760 | 714 | * @return static |
| 761 | 715 | */ |
| 762 | - public function map(callable $callback) |
|
| 763 | - { |
|
| 716 | + public function map(callable $callback) { |
|
| 764 | 717 | $keys = array_keys($this->items); |
| 765 | 718 | |
| 766 | 719 | $items = array_map($callback, $this->items, $keys); |
@@ -774,8 +727,7 @@ discard block |
||
| 774 | 727 | * @param callable $callback |
| 775 | 728 | * @return static |
| 776 | 729 | */ |
| 777 | - public function mapSpread(callable $callback) |
|
| 778 | - { |
|
| 730 | + public function mapSpread(callable $callback) { |
|
| 779 | 731 | return $this->map(function ($chunk) use ($callback) { |
| 780 | 732 | return $callback(...$chunk); |
| 781 | 733 | }); |
@@ -789,8 +741,7 @@ discard block |
||
| 789 | 741 | * @param callable $callback |
| 790 | 742 | * @return static |
| 791 | 743 | */ |
| 792 | - public function mapToGroups(callable $callback) |
|
| 793 | - { |
|
| 744 | + public function mapToGroups(callable $callback) { |
|
| 794 | 745 | $groups = $this->map($callback)->reduce(function ($groups, $pair) { |
| 795 | 746 | $groups[key($pair)][] = reset($pair); |
| 796 | 747 | |
@@ -808,8 +759,7 @@ discard block |
||
| 808 | 759 | * @param callable $callback |
| 809 | 760 | * @return static |
| 810 | 761 | */ |
| 811 | - public function mapWithKeys(callable $callback) |
|
| 812 | - { |
|
| 762 | + public function mapWithKeys(callable $callback) { |
|
| 813 | 763 | $result = []; |
| 814 | 764 | |
| 815 | 765 | foreach ($this->items as $key => $value) { |
@@ -829,8 +779,7 @@ discard block |
||
| 829 | 779 | * @param callable $callback |
| 830 | 780 | * @return static |
| 831 | 781 | */ |
| 832 | - public function flatMap(callable $callback) |
|
| 833 | - { |
|
| 782 | + public function flatMap(callable $callback) { |
|
| 834 | 783 | return $this->map($callback)->collapse(); |
| 835 | 784 | } |
| 836 | 785 | |
@@ -840,8 +789,7 @@ discard block |
||
| 840 | 789 | * @param callable|string|null $callback |
| 841 | 790 | * @return mixed |
| 842 | 791 | */ |
| 843 | - public function max($callback = null) |
|
| 844 | - { |
|
| 792 | + public function max($callback = null) { |
|
| 845 | 793 | $callback = $this->valueRetriever($callback); |
| 846 | 794 | |
| 847 | 795 | return $this->filter(function ($value) { |
@@ -859,8 +807,7 @@ discard block |
||
| 859 | 807 | * @param mixed $items |
| 860 | 808 | * @return static |
| 861 | 809 | */ |
| 862 | - public function merge($items) |
|
| 863 | - { |
|
| 810 | + public function merge($items) { |
|
| 864 | 811 | return new static(array_merge($this->items, $this->getArrayableItems($items))); |
| 865 | 812 | } |
| 866 | 813 | |
@@ -870,8 +817,7 @@ discard block |
||
| 870 | 817 | * @param mixed $values |
| 871 | 818 | * @return static |
| 872 | 819 | */ |
| 873 | - public function combine($values) |
|
| 874 | - { |
|
| 820 | + public function combine($values) { |
|
| 875 | 821 | return new static(array_combine($this->all(), $this->getArrayableItems($values))); |
| 876 | 822 | } |
| 877 | 823 | |
@@ -881,8 +827,7 @@ discard block |
||
| 881 | 827 | * @param mixed $items |
| 882 | 828 | * @return static |
| 883 | 829 | */ |
| 884 | - public function union($items) |
|
| 885 | - { |
|
| 830 | + public function union($items) { |
|
| 886 | 831 | return new static($this->items + $this->getArrayableItems($items)); |
| 887 | 832 | } |
| 888 | 833 | |
@@ -892,8 +837,7 @@ discard block |
||
| 892 | 837 | * @param callable|string|null $callback |
| 893 | 838 | * @return mixed |
| 894 | 839 | */ |
| 895 | - public function min($callback = null) |
|
| 896 | - { |
|
| 840 | + public function min($callback = null) { |
|
| 897 | 841 | $callback = $this->valueRetriever($callback); |
| 898 | 842 | |
| 899 | 843 | return $this->filter(function ($value) { |
@@ -912,8 +856,7 @@ discard block |
||
| 912 | 856 | * @param int $offset |
| 913 | 857 | * @return static |
| 914 | 858 | */ |
| 915 | - public function nth($step, $offset = 0) |
|
| 916 | - { |
|
| 859 | + public function nth($step, $offset = 0) { |
|
| 917 | 860 | $new = []; |
| 918 | 861 | |
| 919 | 862 | $position = 0; |
@@ -935,8 +878,7 @@ discard block |
||
| 935 | 878 | * @param mixed $keys |
| 936 | 879 | * @return static |
| 937 | 880 | */ |
| 938 | - public function only($keys) |
|
| 939 | - { |
|
| 881 | + public function only($keys) { |
|
| 940 | 882 | if (is_null($keys)) { |
| 941 | 883 | return new static($this->items); |
| 942 | 884 | } |
@@ -953,8 +895,7 @@ discard block |
||
| 953 | 895 | * @param int $perPage |
| 954 | 896 | * @return static |
| 955 | 897 | */ |
| 956 | - public function forPage($page, $perPage) |
|
| 957 | - { |
|
| 898 | + public function forPage($page, $perPage) { |
|
| 958 | 899 | return $this->slice(($page - 1) * $perPage, $perPage); |
| 959 | 900 | } |
| 960 | 901 | |
@@ -964,8 +905,7 @@ discard block |
||
| 964 | 905 | * @param callable|string $callback |
| 965 | 906 | * @return static |
| 966 | 907 | */ |
| 967 | - public function partition($callback) |
|
| 968 | - { |
|
| 908 | + public function partition($callback) { |
|
| 969 | 909 | $partitions = [new static, new static]; |
| 970 | 910 | |
| 971 | 911 | $callback = $this->valueRetriever($callback); |
@@ -983,8 +923,7 @@ discard block |
||
| 983 | 923 | * @param callable $callback |
| 984 | 924 | * @return mixed |
| 985 | 925 | */ |
| 986 | - public function pipe(callable $callback) |
|
| 987 | - { |
|
| 926 | + public function pipe(callable $callback) { |
|
| 988 | 927 | return $callback($this); |
| 989 | 928 | } |
| 990 | 929 | |
@@ -993,8 +932,7 @@ discard block |
||
| 993 | 932 | * |
| 994 | 933 | * @return mixed |
| 995 | 934 | */ |
| 996 | - public function pop() |
|
| 997 | - { |
|
| 935 | + public function pop() { |
|
| 998 | 936 | return array_pop($this->items); |
| 999 | 937 | } |
| 1000 | 938 | |
@@ -1005,8 +943,7 @@ discard block |
||
| 1005 | 943 | * @param mixed $key |
| 1006 | 944 | * @return $this |
| 1007 | 945 | */ |
| 1008 | - public function prepend($value, $key = null) |
|
| 1009 | - { |
|
| 946 | + public function prepend($value, $key = null) { |
|
| 1010 | 947 | $this->items = Arr::prepend($this->items, $value, $key); |
| 1011 | 948 | |
| 1012 | 949 | return $this; |
@@ -1018,8 +955,7 @@ discard block |
||
| 1018 | 955 | * @param mixed $value |
| 1019 | 956 | * @return $this |
| 1020 | 957 | */ |
| 1021 | - public function push($value) |
|
| 1022 | - { |
|
| 958 | + public function push($value) { |
|
| 1023 | 959 | $this->offsetSet(null, $value); |
| 1024 | 960 | |
| 1025 | 961 | return $this; |
@@ -1031,8 +967,7 @@ discard block |
||
| 1031 | 967 | * @param \Traversable $source |
| 1032 | 968 | * @return self |
| 1033 | 969 | */ |
| 1034 | - public function concat($source) |
|
| 1035 | - { |
|
| 970 | + public function concat($source) { |
|
| 1036 | 971 | $result = new static($this); |
| 1037 | 972 | |
| 1038 | 973 | foreach ($source as $item) { |
@@ -1049,8 +984,7 @@ discard block |
||
| 1049 | 984 | * @param mixed $default |
| 1050 | 985 | * @return mixed |
| 1051 | 986 | */ |
| 1052 | - public function pull($key, $default = null) |
|
| 1053 | - { |
|
| 987 | + public function pull($key, $default = null) { |
|
| 1054 | 988 | return Arr::pull($this->items, $key, $default); |
| 1055 | 989 | } |
| 1056 | 990 | |
@@ -1061,8 +995,7 @@ discard block |
||
| 1061 | 995 | * @param mixed $value |
| 1062 | 996 | * @return $this |
| 1063 | 997 | */ |
| 1064 | - public function put($key, $value) |
|
| 1065 | - { |
|
| 998 | + public function put($key, $value) { |
|
| 1066 | 999 | $this->offsetSet($key, $value); |
| 1067 | 1000 | |
| 1068 | 1001 | return $this; |
@@ -1076,8 +1009,7 @@ discard block |
||
| 1076 | 1009 | * |
| 1077 | 1010 | * @throws \InvalidArgumentException |
| 1078 | 1011 | */ |
| 1079 | - public function random($number = null) |
|
| 1080 | - { |
|
| 1012 | + public function random($number = null) { |
|
| 1081 | 1013 | if (is_null($number)) { |
| 1082 | 1014 | return Arr::random($this->items); |
| 1083 | 1015 | } |
@@ -1092,8 +1024,7 @@ discard block |
||
| 1092 | 1024 | * @param mixed $initial |
| 1093 | 1025 | * @return mixed |
| 1094 | 1026 | */ |
| 1095 | - public function reduce(callable $callback, $initial = null) |
|
| 1096 | - { |
|
| 1027 | + public function reduce(callable $callback, $initial = null) { |
|
| 1097 | 1028 | return array_reduce($this->items, $callback, $initial); |
| 1098 | 1029 | } |
| 1099 | 1030 | |
@@ -1103,8 +1034,7 @@ discard block |
||
| 1103 | 1034 | * @param callable|mixed $callback |
| 1104 | 1035 | * @return static |
| 1105 | 1036 | */ |
| 1106 | - public function reject($callback) |
|
| 1107 | - { |
|
| 1037 | + public function reject($callback) { |
|
| 1108 | 1038 | if ($this->useAsCallable($callback)) { |
| 1109 | 1039 | return $this->filter(function ($value, $key) use ($callback) { |
| 1110 | 1040 | return ! $callback($value, $key); |
@@ -1121,8 +1051,7 @@ discard block |
||
| 1121 | 1051 | * |
| 1122 | 1052 | * @return static |
| 1123 | 1053 | */ |
| 1124 | - public function reverse() |
|
| 1125 | - { |
|
| 1054 | + public function reverse() { |
|
| 1126 | 1055 | return new static(array_reverse($this->items, true)); |
| 1127 | 1056 | } |
| 1128 | 1057 | |
@@ -1133,8 +1062,7 @@ discard block |
||
| 1133 | 1062 | * @param bool $strict |
| 1134 | 1063 | * @return mixed |
| 1135 | 1064 | */ |
| 1136 | - public function search($value, $strict = false) |
|
| 1137 | - { |
|
| 1065 | + public function search($value, $strict = false) { |
|
| 1138 | 1066 | if (! $this->useAsCallable($value)) { |
| 1139 | 1067 | return array_search($value, $this->items, $strict); |
| 1140 | 1068 | } |
@@ -1153,8 +1081,7 @@ discard block |
||
| 1153 | 1081 | * |
| 1154 | 1082 | * @return mixed |
| 1155 | 1083 | */ |
| 1156 | - public function shift() |
|
| 1157 | - { |
|
| 1084 | + public function shift() { |
|
| 1158 | 1085 | return array_shift($this->items); |
| 1159 | 1086 | } |
| 1160 | 1087 | |
@@ -1164,8 +1091,7 @@ discard block |
||
| 1164 | 1091 | * @param int $seed |
| 1165 | 1092 | * @return static |
| 1166 | 1093 | */ |
| 1167 | - public function shuffle($seed = null) |
|
| 1168 | - { |
|
| 1094 | + public function shuffle($seed = null) { |
|
| 1169 | 1095 | $items = $this->items; |
| 1170 | 1096 | |
| 1171 | 1097 | if (is_null($seed)) { |
@@ -1188,8 +1114,7 @@ discard block |
||
| 1188 | 1114 | * @param int $length |
| 1189 | 1115 | * @return static |
| 1190 | 1116 | */ |
| 1191 | - public function slice($offset, $length = null) |
|
| 1192 | - { |
|
| 1117 | + public function slice($offset, $length = null) { |
|
| 1193 | 1118 | return new static(array_slice($this->items, $offset, $length, true)); |
| 1194 | 1119 | } |
| 1195 | 1120 | |
@@ -1199,8 +1124,7 @@ discard block |
||
| 1199 | 1124 | * @param int $numberOfGroups |
| 1200 | 1125 | * @return static |
| 1201 | 1126 | */ |
| 1202 | - public function split($numberOfGroups) |
|
| 1203 | - { |
|
| 1127 | + public function split($numberOfGroups) { |
|
| 1204 | 1128 | if ($this->isEmpty()) { |
| 1205 | 1129 | return new static; |
| 1206 | 1130 | } |
@@ -1216,8 +1140,7 @@ discard block |
||
| 1216 | 1140 | * @param int $size |
| 1217 | 1141 | * @return static |
| 1218 | 1142 | */ |
| 1219 | - public function chunk($size) |
|
| 1220 | - { |
|
| 1143 | + public function chunk($size) { |
|
| 1221 | 1144 | if ($size <= 0) { |
| 1222 | 1145 | return new static; |
| 1223 | 1146 | } |
@@ -1237,8 +1160,7 @@ discard block |
||
| 1237 | 1160 | * @param callable|null $callback |
| 1238 | 1161 | * @return static |
| 1239 | 1162 | */ |
| 1240 | - public function sort(callable $callback = null) |
|
| 1241 | - { |
|
| 1163 | + public function sort(callable $callback = null) { |
|
| 1242 | 1164 | $items = $this->items; |
| 1243 | 1165 | |
| 1244 | 1166 | $callback |
@@ -1256,8 +1178,7 @@ discard block |
||
| 1256 | 1178 | * @param bool $descending |
| 1257 | 1179 | * @return static |
| 1258 | 1180 | */ |
| 1259 | - public function sortBy($callback, $options = SORT_REGULAR, $descending = false) |
|
| 1260 | - { |
|
| 1181 | + public function sortBy($callback, $options = SORT_REGULAR, $descending = false) { |
|
| 1261 | 1182 | $results = []; |
| 1262 | 1183 | |
| 1263 | 1184 | $callback = $this->valueRetriever($callback); |
@@ -1289,8 +1210,7 @@ discard block |
||
| 1289 | 1210 | * @param int $options |
| 1290 | 1211 | * @return static |
| 1291 | 1212 | */ |
| 1292 | - public function sortByDesc($callback, $options = SORT_REGULAR) |
|
| 1293 | - { |
|
| 1213 | + public function sortByDesc($callback, $options = SORT_REGULAR) { |
|
| 1294 | 1214 | return $this->sortBy($callback, $options, true); |
| 1295 | 1215 | } |
| 1296 | 1216 | |
@@ -1302,8 +1222,7 @@ discard block |
||
| 1302 | 1222 | * @param mixed $replacement |
| 1303 | 1223 | * @return static |
| 1304 | 1224 | */ |
| 1305 | - public function splice($offset, $length = null, $replacement = []) |
|
| 1306 | - { |
|
| 1225 | + public function splice($offset, $length = null, $replacement = []) { |
|
| 1307 | 1226 | if (func_num_args() == 1) { |
| 1308 | 1227 | return new static(array_splice($this->items, $offset)); |
| 1309 | 1228 | } |
@@ -1317,8 +1236,7 @@ discard block |
||
| 1317 | 1236 | * @param callable|string|null $callback |
| 1318 | 1237 | * @return mixed |
| 1319 | 1238 | */ |
| 1320 | - public function sum($callback = null) |
|
| 1321 | - { |
|
| 1239 | + public function sum($callback = null) { |
|
| 1322 | 1240 | if (is_null($callback)) { |
| 1323 | 1241 | return array_sum($this->items); |
| 1324 | 1242 | } |
@@ -1336,8 +1254,7 @@ discard block |
||
| 1336 | 1254 | * @param int $limit |
| 1337 | 1255 | * @return static |
| 1338 | 1256 | */ |
| 1339 | - public function take($limit) |
|
| 1340 | - { |
|
| 1257 | + public function take($limit) { |
|
| 1341 | 1258 | if ($limit < 0) { |
| 1342 | 1259 | return $this->slice($limit, abs($limit)); |
| 1343 | 1260 | } |
@@ -1351,8 +1268,7 @@ discard block |
||
| 1351 | 1268 | * @param callable $callback |
| 1352 | 1269 | * @return $this |
| 1353 | 1270 | */ |
| 1354 | - public function tap(callable $callback) |
|
| 1355 | - { |
|
| 1271 | + public function tap(callable $callback) { |
|
| 1356 | 1272 | $callback(new static($this->items)); |
| 1357 | 1273 | |
| 1358 | 1274 | return $this; |
@@ -1364,8 +1280,7 @@ discard block |
||
| 1364 | 1280 | * @param callable $callback |
| 1365 | 1281 | * @return $this |
| 1366 | 1282 | */ |
| 1367 | - public function transform(callable $callback) |
|
| 1368 | - { |
|
| 1283 | + public function transform(callable $callback) { |
|
| 1369 | 1284 | $this->items = $this->map($callback)->all(); |
| 1370 | 1285 | |
| 1371 | 1286 | return $this; |
@@ -1378,8 +1293,7 @@ discard block |
||
| 1378 | 1293 | * @param bool $strict |
| 1379 | 1294 | * @return static |
| 1380 | 1295 | */ |
| 1381 | - public function unique($key = null, $strict = false) |
|
| 1382 | - { |
|
| 1296 | + public function unique($key = null, $strict = false) { |
|
| 1383 | 1297 | if (is_null($key)) { |
| 1384 | 1298 | return new static(array_unique($this->items, SORT_REGULAR)); |
| 1385 | 1299 | } |
@@ -1403,8 +1317,7 @@ discard block |
||
| 1403 | 1317 | * @param string|callable|null $key |
| 1404 | 1318 | * @return static |
| 1405 | 1319 | */ |
| 1406 | - public function uniqueStrict($key = null) |
|
| 1407 | - { |
|
| 1320 | + public function uniqueStrict($key = null) { |
|
| 1408 | 1321 | return $this->unique($key, true); |
| 1409 | 1322 | } |
| 1410 | 1323 | |
@@ -1413,8 +1326,7 @@ discard block |
||
| 1413 | 1326 | * |
| 1414 | 1327 | * @return static |
| 1415 | 1328 | */ |
| 1416 | - public function values() |
|
| 1417 | - { |
|
| 1329 | + public function values() { |
|
| 1418 | 1330 | return new static(array_values($this->items)); |
| 1419 | 1331 | } |
| 1420 | 1332 | |
@@ -1424,8 +1336,7 @@ discard block |
||
| 1424 | 1336 | * @param string $value |
| 1425 | 1337 | * @return callable |
| 1426 | 1338 | */ |
| 1427 | - protected function valueRetriever($value) |
|
| 1428 | - { |
|
| 1339 | + protected function valueRetriever($value) { |
|
| 1429 | 1340 | if ($this->useAsCallable($value)) { |
| 1430 | 1341 | return $value; |
| 1431 | 1342 | } |
@@ -1444,8 +1355,7 @@ discard block |
||
| 1444 | 1355 | * @param mixed ...$items |
| 1445 | 1356 | * @return static |
| 1446 | 1357 | */ |
| 1447 | - public function zip($items) |
|
| 1448 | - { |
|
| 1358 | + public function zip($items) { |
|
| 1449 | 1359 | $arrayableItems = array_map(function ($items) { |
| 1450 | 1360 | return $this->getArrayableItems($items); |
| 1451 | 1361 | }, func_get_args()); |
@@ -1462,8 +1372,7 @@ discard block |
||
| 1462 | 1372 | * |
| 1463 | 1373 | * @return array |
| 1464 | 1374 | */ |
| 1465 | - public function toArray() |
|
| 1466 | - { |
|
| 1375 | + public function toArray() { |
|
| 1467 | 1376 | return array_map(function ($value) { |
| 1468 | 1377 | return $value instanceof Arrayable ? $value->toArray() : $value; |
| 1469 | 1378 | }, $this->items); |
@@ -1474,8 +1383,7 @@ discard block |
||
| 1474 | 1383 | * |
| 1475 | 1384 | * @return array |
| 1476 | 1385 | */ |
| 1477 | - public function jsonSerialize() |
|
| 1478 | - { |
|
| 1386 | + public function jsonSerialize() { |
|
| 1479 | 1387 | return array_map(function ($value) { |
| 1480 | 1388 | if ($value instanceof JsonSerializable) { |
| 1481 | 1389 | return $value->jsonSerialize(); |
@@ -1495,8 +1403,7 @@ discard block |
||
| 1495 | 1403 | * @param int $options |
| 1496 | 1404 | * @return string |
| 1497 | 1405 | */ |
| 1498 | - public function toJson($options = 0) |
|
| 1499 | - { |
|
| 1406 | + public function toJson($options = 0) { |
|
| 1500 | 1407 | return json_encode($this->jsonSerialize(), $options); |
| 1501 | 1408 | } |
| 1502 | 1409 | |
@@ -1505,8 +1412,7 @@ discard block |
||
| 1505 | 1412 | * |
| 1506 | 1413 | * @return \ArrayIterator |
| 1507 | 1414 | */ |
| 1508 | - public function getIterator() |
|
| 1509 | - { |
|
| 1415 | + public function getIterator() { |
|
| 1510 | 1416 | return new ArrayIterator($this->items); |
| 1511 | 1417 | } |
| 1512 | 1418 | |
@@ -1516,8 +1422,7 @@ discard block |
||
| 1516 | 1422 | * @param int $flags |
| 1517 | 1423 | * @return \CachingIterator |
| 1518 | 1424 | */ |
| 1519 | - public function getCachingIterator($flags = CachingIterator::CALL_TOSTRING) |
|
| 1520 | - { |
|
| 1425 | + public function getCachingIterator($flags = CachingIterator::CALL_TOSTRING) { |
|
| 1521 | 1426 | return new CachingIterator($this->getIterator(), $flags); |
| 1522 | 1427 | } |
| 1523 | 1428 | |
@@ -1526,8 +1431,7 @@ discard block |
||
| 1526 | 1431 | * |
| 1527 | 1432 | * @return int |
| 1528 | 1433 | */ |
| 1529 | - public function count() |
|
| 1530 | - { |
|
| 1434 | + public function count() { |
|
| 1531 | 1435 | return count($this->items); |
| 1532 | 1436 | } |
| 1533 | 1437 | |
@@ -1536,8 +1440,7 @@ discard block |
||
| 1536 | 1440 | * |
| 1537 | 1441 | * @return \Illuminate\Support\Collection |
| 1538 | 1442 | */ |
| 1539 | - public function toBase() |
|
| 1540 | - { |
|
| 1443 | + public function toBase() { |
|
| 1541 | 1444 | return new self($this); |
| 1542 | 1445 | } |
| 1543 | 1446 | |
@@ -1547,8 +1450,7 @@ discard block |
||
| 1547 | 1450 | * @param mixed $key |
| 1548 | 1451 | * @return bool |
| 1549 | 1452 | */ |
| 1550 | - public function offsetExists($key) |
|
| 1551 | - { |
|
| 1453 | + public function offsetExists($key) { |
|
| 1552 | 1454 | return array_key_exists($key, $this->items); |
| 1553 | 1455 | } |
| 1554 | 1456 | |
@@ -1558,8 +1460,7 @@ discard block |
||
| 1558 | 1460 | * @param mixed $key |
| 1559 | 1461 | * @return mixed |
| 1560 | 1462 | */ |
| 1561 | - public function offsetGet($key) |
|
| 1562 | - { |
|
| 1463 | + public function offsetGet($key) { |
|
| 1563 | 1464 | return $this->items[$key]; |
| 1564 | 1465 | } |
| 1565 | 1466 | |
@@ -1570,8 +1471,7 @@ discard block |
||
| 1570 | 1471 | * @param mixed $value |
| 1571 | 1472 | * @return void |
| 1572 | 1473 | */ |
| 1573 | - public function offsetSet($key, $value) |
|
| 1574 | - { |
|
| 1474 | + public function offsetSet($key, $value) { |
|
| 1575 | 1475 | if (is_null($key)) { |
| 1576 | 1476 | $this->items[] = $value; |
| 1577 | 1477 | } else { |
@@ -1585,8 +1485,7 @@ discard block |
||
| 1585 | 1485 | * @param string $key |
| 1586 | 1486 | * @return void |
| 1587 | 1487 | */ |
| 1588 | - public function offsetUnset($key) |
|
| 1589 | - { |
|
| 1488 | + public function offsetUnset($key) { |
|
| 1590 | 1489 | unset($this->items[$key]); |
| 1591 | 1490 | } |
| 1592 | 1491 | |
@@ -1595,8 +1494,7 @@ discard block |
||
| 1595 | 1494 | * |
| 1596 | 1495 | * @return string |
| 1597 | 1496 | */ |
| 1598 | - public function __toString() |
|
| 1599 | - { |
|
| 1497 | + public function __toString() { |
|
| 1600 | 1498 | return $this->toJson(); |
| 1601 | 1499 | } |
| 1602 | 1500 | |
@@ -1606,8 +1504,7 @@ discard block |
||
| 1606 | 1504 | * @param mixed $items |
| 1607 | 1505 | * @return array |
| 1608 | 1506 | */ |
| 1609 | - protected function getArrayableItems($items) |
|
| 1610 | - { |
|
| 1507 | + protected function getArrayableItems($items) { |
|
| 1611 | 1508 | if (is_array($items)) { |
| 1612 | 1509 | return $items; |
| 1613 | 1510 | } elseif ($items instanceof self) { |
@@ -1631,8 +1528,7 @@ discard block |
||
| 1631 | 1528 | * @param string $method |
| 1632 | 1529 | * @return void |
| 1633 | 1530 | */ |
| 1634 | - public static function proxy($method) |
|
| 1635 | - { |
|
| 1531 | + public static function proxy($method) { |
|
| 1636 | 1532 | static::$proxies[] = $method; |
| 1637 | 1533 | } |
| 1638 | 1534 | |
@@ -1644,8 +1540,7 @@ discard block |
||
| 1644 | 1540 | * |
| 1645 | 1541 | * @throws \Exception |
| 1646 | 1542 | */ |
| 1647 | - public function __get($key) |
|
| 1648 | - { |
|
| 1543 | + public function __get($key) { |
|
| 1649 | 1544 | if (! in_array($key, static::$proxies)) { |
| 1650 | 1545 | throw new Exception("Property [{$key}] does not exist on this collection instance."); |
| 1651 | 1546 | } |
@@ -5,8 +5,7 @@ discard block |
||
| 5 | 5 | /** |
| 6 | 6 | * @see \Illuminate\Http\Request |
| 7 | 7 | */ |
| 8 | -class Input extends Facade |
|
| 9 | -{ |
|
| 8 | +class Input extends Facade { |
|
| 10 | 9 | /** |
| 11 | 10 | * Get an item from the input data. |
| 12 | 11 | * |
@@ -16,8 +15,7 @@ discard block |
||
| 16 | 15 | * @param mixed $default |
| 17 | 16 | * @return mixed |
| 18 | 17 | */ |
| 19 | - public static function get($key = null, $default = null) |
|
| 20 | - { |
|
| 18 | + public static function get($key = null, $default = null) { |
|
| 21 | 19 | return static::$app['request']->input($key, $default); |
| 22 | 20 | } |
| 23 | 21 | |
@@ -26,8 +24,7 @@ discard block |
||
| 26 | 24 | * |
| 27 | 25 | * @return string |
| 28 | 26 | */ |
| 29 | - protected static function getFacadeAccessor() |
|
| 30 | - { |
|
| 27 | + protected static function getFacadeAccessor() { |
|
| 31 | 28 | return 'request'; |
| 32 | 29 | } |
| 33 | 30 | } |
@@ -6,8 +6,7 @@ discard block |
||
| 6 | 6 | use InvalidArgumentException; |
| 7 | 7 | use Illuminate\Support\Traits\Macroable; |
| 8 | 8 | |
| 9 | -class Arr |
|
| 10 | -{ |
|
| 9 | +class Arr { |
|
| 11 | 10 | use Macroable; |
| 12 | 11 | |
| 13 | 12 | /** |
@@ -16,8 +15,7 @@ discard block |
||
| 16 | 15 | * @param mixed $value |
| 17 | 16 | * @return bool |
| 18 | 17 | */ |
| 19 | - public static function accessible($value) |
|
| 20 | - { |
|
| 18 | + public static function accessible($value) { |
|
| 21 | 19 | return is_array($value) || $value instanceof ArrayAccess; |
| 22 | 20 | } |
| 23 | 21 | |
@@ -29,8 +27,7 @@ discard block |
||
| 29 | 27 | * @param mixed $value |
| 30 | 28 | * @return array |
| 31 | 29 | */ |
| 32 | - public static function add($array, $key, $value) |
|
| 33 | - { |
|
| 30 | + public static function add($array, $key, $value) { |
|
| 34 | 31 | if (is_null(static::get($array, $key))) { |
| 35 | 32 | static::set($array, $key, $value); |
| 36 | 33 | } |
@@ -44,8 +41,7 @@ discard block |
||
| 44 | 41 | * @param array $array |
| 45 | 42 | * @return array |
| 46 | 43 | */ |
| 47 | - public static function collapse($array) |
|
| 48 | - { |
|
| 44 | + public static function collapse($array) { |
|
| 49 | 45 | $results = []; |
| 50 | 46 | |
| 51 | 47 | foreach ($array as $values) { |
@@ -67,8 +63,7 @@ discard block |
||
| 67 | 63 | * @param array ...$arrays |
| 68 | 64 | * @return array |
| 69 | 65 | */ |
| 70 | - public static function crossJoin(...$arrays) |
|
| 71 | - { |
|
| 66 | + public static function crossJoin(...$arrays) { |
|
| 72 | 67 | $results = [[]]; |
| 73 | 68 | |
| 74 | 69 | foreach ($arrays as $index => $array) { |
@@ -94,8 +89,7 @@ discard block |
||
| 94 | 89 | * @param array $array |
| 95 | 90 | * @return array |
| 96 | 91 | */ |
| 97 | - public static function divide($array) |
|
| 98 | - { |
|
| 92 | + public static function divide($array) { |
|
| 99 | 93 | return [array_keys($array), array_values($array)]; |
| 100 | 94 | } |
| 101 | 95 | |
@@ -106,8 +100,7 @@ discard block |
||
| 106 | 100 | * @param string $prepend |
| 107 | 101 | * @return array |
| 108 | 102 | */ |
| 109 | - public static function dot($array, $prepend = '') |
|
| 110 | - { |
|
| 103 | + public static function dot($array, $prepend = '') { |
|
| 111 | 104 | $results = []; |
| 112 | 105 | |
| 113 | 106 | foreach ($array as $key => $value) { |
@@ -128,8 +121,7 @@ discard block |
||
| 128 | 121 | * @param array|string $keys |
| 129 | 122 | * @return array |
| 130 | 123 | */ |
| 131 | - public static function except($array, $keys) |
|
| 132 | - { |
|
| 124 | + public static function except($array, $keys) { |
|
| 133 | 125 | static::forget($array, $keys); |
| 134 | 126 | |
| 135 | 127 | return $array; |
@@ -142,8 +134,7 @@ discard block |
||
| 142 | 134 | * @param string|int $key |
| 143 | 135 | * @return bool |
| 144 | 136 | */ |
| 145 | - public static function exists($array, $key) |
|
| 146 | - { |
|
| 137 | + public static function exists($array, $key) { |
|
| 147 | 138 | if ($array instanceof ArrayAccess) { |
| 148 | 139 | return $array->offsetExists($key); |
| 149 | 140 | } |
@@ -159,8 +150,7 @@ discard block |
||
| 159 | 150 | * @param mixed $default |
| 160 | 151 | * @return mixed |
| 161 | 152 | */ |
| 162 | - public static function first($array, callable $callback = null, $default = null) |
|
| 163 | - { |
|
| 153 | + public static function first($array, callable $callback = null, $default = null) { |
|
| 164 | 154 | if (is_null($callback)) { |
| 165 | 155 | if (empty($array)) { |
| 166 | 156 | return value($default); |
@@ -188,8 +178,7 @@ discard block |
||
| 188 | 178 | * @param mixed $default |
| 189 | 179 | * @return mixed |
| 190 | 180 | */ |
| 191 | - public static function last($array, callable $callback = null, $default = null) |
|
| 192 | - { |
|
| 181 | + public static function last($array, callable $callback = null, $default = null) { |
|
| 193 | 182 | if (is_null($callback)) { |
| 194 | 183 | return empty($array) ? value($default) : end($array); |
| 195 | 184 | } |
@@ -204,8 +193,7 @@ discard block |
||
| 204 | 193 | * @param int $depth |
| 205 | 194 | * @return array |
| 206 | 195 | */ |
| 207 | - public static function flatten($array, $depth = INF) |
|
| 208 | - { |
|
| 196 | + public static function flatten($array, $depth = INF) { |
|
| 209 | 197 | return array_reduce($array, function ($result, $item) use ($depth) { |
| 210 | 198 | $item = $item instanceof Collection ? $item->all() : $item; |
| 211 | 199 | |
@@ -226,8 +214,7 @@ discard block |
||
| 226 | 214 | * @param array|string $keys |
| 227 | 215 | * @return void |
| 228 | 216 | */ |
| 229 | - public static function forget(&$array, $keys) |
|
| 230 | - { |
|
| 217 | + public static function forget(&$array, $keys) { |
|
| 231 | 218 | $original = &$array; |
| 232 | 219 | |
| 233 | 220 | $keys = (array) $keys; |
@@ -271,8 +258,7 @@ discard block |
||
| 271 | 258 | * @param mixed $default |
| 272 | 259 | * @return mixed |
| 273 | 260 | */ |
| 274 | - public static function get($array, $key, $default = null) |
|
| 275 | - { |
|
| 261 | + public static function get($array, $key, $default = null) { |
|
| 276 | 262 | if (! static::accessible($array)) { |
| 277 | 263 | return value($default); |
| 278 | 264 | } |
@@ -303,8 +289,7 @@ discard block |
||
| 303 | 289 | * @param string|array $keys |
| 304 | 290 | * @return bool |
| 305 | 291 | */ |
| 306 | - public static function has($array, $keys) |
|
| 307 | - { |
|
| 292 | + public static function has($array, $keys) { |
|
| 308 | 293 | if (is_null($keys)) { |
| 309 | 294 | return false; |
| 310 | 295 | } |
@@ -346,8 +331,7 @@ discard block |
||
| 346 | 331 | * @param array $array |
| 347 | 332 | * @return bool |
| 348 | 333 | */ |
| 349 | - public static function isAssoc(array $array) |
|
| 350 | - { |
|
| 334 | + public static function isAssoc(array $array) { |
|
| 351 | 335 | $keys = array_keys($array); |
| 352 | 336 | |
| 353 | 337 | return array_keys($keys) !== $keys; |
@@ -360,8 +344,7 @@ discard block |
||
| 360 | 344 | * @param array|string $keys |
| 361 | 345 | * @return array |
| 362 | 346 | */ |
| 363 | - public static function only($array, $keys) |
|
| 364 | - { |
|
| 347 | + public static function only($array, $keys) { |
|
| 365 | 348 | return array_intersect_key($array, array_flip((array) $keys)); |
| 366 | 349 | } |
| 367 | 350 | |
@@ -373,8 +356,7 @@ discard block |
||
| 373 | 356 | * @param string|array|null $key |
| 374 | 357 | * @return array |
| 375 | 358 | */ |
| 376 | - public static function pluck($array, $value, $key = null) |
|
| 377 | - { |
|
| 359 | + public static function pluck($array, $value, $key = null) { |
|
| 378 | 360 | $results = []; |
| 379 | 361 | |
| 380 | 362 | list($value, $key) = static::explodePluckParameters($value, $key); |
@@ -408,8 +390,7 @@ discard block |
||
| 408 | 390 | * @param string|array|null $key |
| 409 | 391 | * @return array |
| 410 | 392 | */ |
| 411 | - protected static function explodePluckParameters($value, $key) |
|
| 412 | - { |
|
| 393 | + protected static function explodePluckParameters($value, $key) { |
|
| 413 | 394 | $value = is_string($value) ? explode('.', $value) : $value; |
| 414 | 395 | |
| 415 | 396 | $key = is_null($key) || is_array($key) ? $key : explode('.', $key); |
@@ -425,8 +406,7 @@ discard block |
||
| 425 | 406 | * @param mixed $key |
| 426 | 407 | * @return array |
| 427 | 408 | */ |
| 428 | - public static function prepend($array, $value, $key = null) |
|
| 429 | - { |
|
| 409 | + public static function prepend($array, $value, $key = null) { |
|
| 430 | 410 | if (is_null($key)) { |
| 431 | 411 | array_unshift($array, $value); |
| 432 | 412 | } else { |
@@ -444,8 +424,7 @@ discard block |
||
| 444 | 424 | * @param mixed $default |
| 445 | 425 | * @return mixed |
| 446 | 426 | */ |
| 447 | - public static function pull(&$array, $key, $default = null) |
|
| 448 | - { |
|
| 427 | + public static function pull(&$array, $key, $default = null) { |
|
| 449 | 428 | $value = static::get($array, $key, $default); |
| 450 | 429 | |
| 451 | 430 | static::forget($array, $key); |
@@ -462,8 +441,7 @@ discard block |
||
| 462 | 441 | * |
| 463 | 442 | * @throws \InvalidArgumentException |
| 464 | 443 | */ |
| 465 | - public static function random($array, $number = null) |
|
| 466 | - { |
|
| 444 | + public static function random($array, $number = null) { |
|
| 467 | 445 | $requested = is_null($number) ? 1 : $number; |
| 468 | 446 | |
| 469 | 447 | $count = count($array); |
@@ -503,8 +481,7 @@ discard block |
||
| 503 | 481 | * @param mixed $value |
| 504 | 482 | * @return array |
| 505 | 483 | */ |
| 506 | - public static function set(&$array, $key, $value) |
|
| 507 | - { |
|
| 484 | + public static function set(&$array, $key, $value) { |
|
| 508 | 485 | if (is_null($key)) { |
| 509 | 486 | return $array = $value; |
| 510 | 487 | } |
@@ -535,8 +512,7 @@ discard block |
||
| 535 | 512 | * @param array $array |
| 536 | 513 | * @return array |
| 537 | 514 | */ |
| 538 | - public static function shuffle($array) |
|
| 539 | - { |
|
| 515 | + public static function shuffle($array) { |
|
| 540 | 516 | shuffle($array); |
| 541 | 517 | |
| 542 | 518 | return $array; |
@@ -549,8 +525,7 @@ discard block |
||
| 549 | 525 | * @param callable|string $callback |
| 550 | 526 | * @return array |
| 551 | 527 | */ |
| 552 | - public static function sort($array, $callback) |
|
| 553 | - { |
|
| 528 | + public static function sort($array, $callback) { |
|
| 554 | 529 | return Collection::make($array)->sortBy($callback)->all(); |
| 555 | 530 | } |
| 556 | 531 | |
@@ -560,8 +535,7 @@ discard block |
||
| 560 | 535 | * @param array $array |
| 561 | 536 | * @return array |
| 562 | 537 | */ |
| 563 | - public static function sortRecursive($array) |
|
| 564 | - { |
|
| 538 | + public static function sortRecursive($array) { |
|
| 565 | 539 | foreach ($array as &$value) { |
| 566 | 540 | if (is_array($value)) { |
| 567 | 541 | $value = static::sortRecursive($value); |
@@ -584,8 +558,7 @@ discard block |
||
| 584 | 558 | * @param callable $callback |
| 585 | 559 | * @return array |
| 586 | 560 | */ |
| 587 | - public static function where($array, callable $callback) |
|
| 588 | - { |
|
| 561 | + public static function where($array, callable $callback) { |
|
| 589 | 562 | return array_filter($array, $callback, ARRAY_FILTER_USE_BOTH); |
| 590 | 563 | } |
| 591 | 564 | |
@@ -595,8 +568,7 @@ discard block |
||
| 595 | 568 | * @param mixed $value |
| 596 | 569 | * @return array |
| 597 | 570 | */ |
| 598 | - public static function wrap($value) |
|
| 599 | - { |
|
| 571 | + public static function wrap($value) { |
|
| 600 | 572 | return ! is_array($value) ? [$value] : $value; |
| 601 | 573 | } |
| 602 | 574 | } |
@@ -4,8 +4,7 @@ |
||
| 4 | 4 | |
| 5 | 5 | use Symfony\Component\VarDumper\Dumper\HtmlDumper as SymfonyHtmlDumper; |
| 6 | 6 | |
| 7 | -class HtmlDumper extends SymfonyHtmlDumper |
|
| 8 | -{ |
|
| 7 | +class HtmlDumper extends SymfonyHtmlDumper { |
|
| 9 | 8 | /** |
| 10 | 9 | * Colour definitions for output. |
| 11 | 10 | * |
@@ -5,16 +5,14 @@ |
||
| 5 | 5 | use Symfony\Component\VarDumper\Cloner\VarCloner; |
| 6 | 6 | use Symfony\Component\VarDumper\Dumper\CliDumper; |
| 7 | 7 | |
| 8 | -class Dumper |
|
| 9 | -{ |
|
| 8 | +class Dumper { |
|
| 10 | 9 | /** |
| 11 | 10 | * Dump a value with elegance. |
| 12 | 11 | * |
| 13 | 12 | * @param mixed $value |
| 14 | 13 | * @return void |
| 15 | 14 | */ |
| 16 | - public function dump($value) |
|
| 17 | - { |
|
| 15 | + public function dump($value) { |
|
| 18 | 16 | if (class_exists(CliDumper::class)) { |
| 19 | 17 | $dumper = 'cli' === PHP_SAPI ? new CliDumper : new HtmlDumper; |
| 20 | 18 | |
@@ -2,8 +2,7 @@ |
||
| 2 | 2 | |
| 3 | 3 | namespace Illuminate\Contracts\Logging; |
| 4 | 4 | |
| 5 | -interface Log |
|
| 6 | -{ |
|
| 5 | +interface Log { |
|
| 7 | 6 | /** |
| 8 | 7 | * Log an alert message to the logs. |
| 9 | 8 | * |
@@ -22,8 +22,7 @@ |
||
| 22 | 22 | * |
| 23 | 23 | * @psalm-immutable |
| 24 | 24 | */ |
| 25 | -final class NegativeInteger extends Integer implements PseudoType |
|
| 26 | -{ |
|
| 25 | +final class NegativeInteger extends Integer implements PseudoType { |
|
| 27 | 26 | public function underlyingType(): Type |
| 28 | 27 | { |
| 29 | 28 | return new Integer(); |