@@ -286,7 +286,7 @@ discard block |
||
| 286 | 286 | /** |
| 287 | 287 | * Get a property by name. |
| 288 | 288 | * |
| 289 | - * @param $key |
|
| 289 | + * @param string $key |
|
| 290 | 290 | * @return string|static |
| 291 | 291 | */ |
| 292 | 292 | private function getByPropertyName($key) |
@@ -305,7 +305,7 @@ discard block |
||
| 305 | 305 | /** |
| 306 | 306 | * Execute a closure via Laravel's Collection |
| 307 | 307 | * |
| 308 | - * @param $closure |
|
| 308 | + * @param Closure $closure |
|
| 309 | 309 | * @param null $method |
| 310 | 310 | * @return mixed |
| 311 | 311 | */ |
@@ -454,7 +454,7 @@ discard block |
||
| 454 | 454 | |
| 455 | 455 | /** |
| 456 | 456 | * @param $originalCallback |
| 457 | - * @return callable |
|
| 457 | + * @return Closure |
|
| 458 | 458 | */ |
| 459 | 459 | public function coollectizeCallback(callable $originalCallback = null) |
| 460 | 460 | { |
@@ -467,7 +467,7 @@ discard block |
||
| 467 | 467 | |
| 468 | 468 | /** |
| 469 | 469 | * @param $originalCallback |
| 470 | - * @return callable |
|
| 470 | + * @return Closure |
|
| 471 | 471 | */ |
| 472 | 472 | public function coollectizeCallbackForReduce(callable $originalCallback) |
| 473 | 473 | { |
@@ -2,20 +2,19 @@ |
||
| 2 | 2 | |
| 3 | 3 | namespace PragmaRX\Coollection\Package; |
| 4 | 4 | |
| 5 | +use ArrayAccess; |
|
| 5 | 6 | use Closure; |
| 6 | 7 | use Countable; |
| 7 | 8 | use Exception; |
| 8 | -use ArrayAccess; |
|
| 9 | -use JsonSerializable; |
|
| 10 | -use IteratorAggregate; |
|
| 11 | -use IlluminateAgnostic\Str\Support\Str; |
|
| 12 | 9 | use IlluminateAgnostic\Arr\Support\Arr; |
| 13 | -use IlluminateAgnostic\Collection\Support\Collection; |
|
| 14 | -use IlluminateAgnostic\Collection\Support\Traits\Macroable; |
|
| 15 | -use IlluminateAgnostic\Collection\Contracts\Support\Jsonable; |
|
| 16 | 10 | use IlluminateAgnostic\Collection\Contracts\Support\Arrayable; |
| 17 | -use IlluminateAgnostic\Collection\Support\HigherOrderCollectionProxy; |
|
| 11 | +use IlluminateAgnostic\Collection\Contracts\Support\Jsonable; |
|
| 18 | 12 | use IlluminateAgnostic\Collection\Support\Collection as TightencoCollect; |
| 13 | +use IlluminateAgnostic\Collection\Support\HigherOrderCollectionProxy; |
|
| 14 | +use IlluminateAgnostic\Collection\Support\Traits\Macroable; |
|
| 15 | +use IlluminateAgnostic\Str\Support\Str; |
|
| 16 | +use IteratorAggregate; |
|
| 17 | +use JsonSerializable; |
|
| 19 | 18 | |
| 20 | 19 | class Coollection implements ArrayAccess, Arrayable, Countable, IteratorAggregate, Jsonable, JsonSerializable |
| 21 | 20 | { |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | */ |
| 104 | 104 | public function call($name, $arguments = []) |
| 105 | 105 | { |
| 106 | - return $this->runViaLaravelCollection(function ($collection) use ($name, $arguments) { |
|
| 106 | + return $this->runViaLaravelCollection(function($collection) use ($name, $arguments) { |
|
| 107 | 107 | return call_user_func_array( |
| 108 | 108 | [$collection, $name], |
| 109 | 109 | $this->coollectizeCallbacks($this->__toArray($arguments), $name) |
@@ -121,11 +121,11 @@ discard block |
||
| 121 | 121 | { |
| 122 | 122 | $value = is_null($value) ? $this->items : $value; |
| 123 | 123 | |
| 124 | - if (! $this->isArrayable($value)) { |
|
| 124 | + if (!$this->isArrayable($value)) { |
|
| 125 | 125 | return $value; |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | - $result = array_map(function ($value) { |
|
| 128 | + $result = array_map(function($value) { |
|
| 129 | 129 | if ($this->isArrayable($value)) { |
| 130 | 130 | return new static($value); |
| 131 | 131 | } |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | */ |
| 144 | 144 | public function toArray() |
| 145 | 145 | { |
| 146 | - return array_map(function ($value) { |
|
| 146 | + return array_map(function($value) { |
|
| 147 | 147 | return $value instanceof Arrayable ? $value->toArray() : $value; |
| 148 | 148 | }, $this->items); |
| 149 | 149 | } |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | return null; |
| 171 | 171 | } |
| 172 | 172 | |
| 173 | - return $this->runViaLaravelCollection(function ($collection) use ($key) { |
|
| 173 | + return $this->runViaLaravelCollection(function($collection) use ($key) { |
|
| 174 | 174 | return new HigherOrderCollectionProxy($collection, $key); |
| 175 | 175 | }); |
| 176 | 176 | } |
@@ -185,11 +185,11 @@ discard block |
||
| 185 | 185 | { |
| 186 | 186 | $value = is_null($value) ? $this->items : $value; |
| 187 | 187 | |
| 188 | - if (! $this->isArrayable($value)) { |
|
| 188 | + if (!$this->isArrayable($value)) { |
|
| 189 | 189 | return $value; |
| 190 | 190 | } |
| 191 | 191 | |
| 192 | - $result = array_map(function ($value) { |
|
| 192 | + $result = array_map(function($value) { |
|
| 193 | 193 | if ($this->isArrayable($value)) { |
| 194 | 194 | return $this->__toArray($value); |
| 195 | 195 | } |
@@ -259,7 +259,7 @@ discard block |
||
| 259 | 259 | return $key; |
| 260 | 260 | } |
| 261 | 261 | |
| 262 | - $value = $this->keys()->mapWithKeys(function ($item) { |
|
| 262 | + $value = $this->keys()->mapWithKeys(function($item) { |
|
| 263 | 263 | return [$this->snake($item) => $item]; |
| 264 | 264 | })->get(lower($key)); |
| 265 | 265 | |
@@ -315,7 +315,7 @@ discard block |
||
| 315 | 315 | |
| 316 | 316 | $result = $closure($collection); |
| 317 | 317 | |
| 318 | - if (! $this->methodMustReturnArray($method)) { |
|
| 318 | + if (!$this->methodMustReturnArray($method)) { |
|
| 319 | 319 | $result = $this->coollectizeItems($result); |
| 320 | 320 | } |
| 321 | 321 | |
@@ -399,7 +399,7 @@ discard block |
||
| 399 | 399 | */ |
| 400 | 400 | public function offsetGet($key) |
| 401 | 401 | { |
| 402 | - if (! isset($this->items[$key])) { |
|
| 402 | + if (!isset($this->items[$key])) { |
|
| 403 | 403 | return null; |
| 404 | 404 | } |
| 405 | 405 | |
@@ -458,7 +458,7 @@ discard block |
||
| 458 | 458 | */ |
| 459 | 459 | public function coollectizeCallback(callable $originalCallback = null) |
| 460 | 460 | { |
| 461 | - return function ($value = null, $key = null) use ($originalCallback) { |
|
| 461 | + return function($value = null, $key = null) use ($originalCallback) { |
|
| 462 | 462 | return $originalCallback( |
| 463 | 463 | $this->__wrap($value), $key |
| 464 | 464 | ); |
@@ -471,7 +471,7 @@ discard block |
||
| 471 | 471 | */ |
| 472 | 472 | public function coollectizeCallbackForReduce(callable $originalCallback) |
| 473 | 473 | { |
| 474 | - return function ($carry, $item) use ($originalCallback) { |
|
| 474 | + return function($carry, $item) use ($originalCallback) { |
|
| 475 | 475 | return $originalCallback( |
| 476 | 476 | $carry, |
| 477 | 477 | $this->__wrap($item) |
@@ -70,7 +70,7 @@ |
||
| 70 | 70 | */ |
| 71 | 71 | public static function __callStatic($method, $parameters) |
| 72 | 72 | { |
| 73 | - if (! static::hasMacro($method)) { |
|
| 73 | + if (!static::hasMacro($method)) { |
|
| 74 | 74 | throw new BadMethodCallException("Method {$method} does not exist."); |
| 75 | 75 | } |
| 76 | 76 | |
@@ -3,7 +3,7 @@ discard block |
||
| 3 | 3 | use IlluminateAgnostic\Str\Support\Str; |
| 4 | 4 | use PragmaRX\Coollection\Package\Coollection; |
| 5 | 5 | |
| 6 | -if (! function_exists('coollect')) { |
|
| 6 | +if (!function_exists('coollect')) { |
|
| 7 | 7 | /** |
| 8 | 8 | * Create a collection from the given value. |
| 9 | 9 | * |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | } |
| 21 | 21 | } |
| 22 | 22 | |
| 23 | -if (! function_exists('snake')) { |
|
| 23 | +if (!function_exists('snake')) { |
|
| 24 | 24 | /** |
| 25 | 25 | * Convert a string to snake case. |
| 26 | 26 | * |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | } |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | -if (! function_exists('lower')) { |
|
| 37 | +if (!function_exists('lower')) { |
|
| 38 | 38 | /** |
| 39 | 39 | * Convert the given string to lower-case. |
| 40 | 40 | * |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | } |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | -if (! function_exists('upper')) { |
|
| 50 | +if (!function_exists('upper')) { |
|
| 51 | 51 | /** |
| 52 | 52 | * Convert the given string to lower-case. |
| 53 | 53 | * |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | /** |
| 64 | 64 | * @codeCoverageIgnore |
| 65 | 65 | */ |
| 66 | -if (! function_exists('dump')) { |
|
| 66 | +if (!function_exists('dump')) { |
|
| 67 | 67 | function dump(...$args) |
| 68 | 68 | { |
| 69 | 69 | foreach ($args as $value) { |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | /** |
| 76 | 76 | * @codeCoverageIgnore |
| 77 | 77 | */ |
| 78 | -if (! function_exists('dd')) { |
|
| 78 | +if (!function_exists('dd')) { |
|
| 79 | 79 | function dd(...$args) |
| 80 | 80 | { |
| 81 | 81 | dump(...$args); |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | } |
| 85 | 85 | } |
| 86 | 86 | |
| 87 | -if (! function_exists('starts_with')) { |
|
| 87 | +if (!function_exists('starts_with')) { |
|
| 88 | 88 | /** |
| 89 | 89 | * Determine if a given string starts with a given substring. |
| 90 | 90 | * |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | } |
| 99 | 99 | } |
| 100 | 100 | |
| 101 | -if (! function_exists('array_sort_by_keys_recursive')) { |
|
| 101 | +if (!function_exists('array_sort_by_keys_recursive')) { |
|
| 102 | 102 | /** |
| 103 | 103 | * Determine if a given string starts with a given substring. |
| 104 | 104 | * |