@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | /** |
210 | 210 | * Determine if an item exists in the collection. |
211 | 211 | * |
212 | - * @param mixed $key |
|
212 | + * @param \Closure $key |
|
213 | 213 | * @param mixed $operator |
214 | 214 | * @param mixed $value |
215 | 215 | * @return bool |
@@ -452,7 +452,7 @@ discard block |
||
452 | 452 | * Filter items by the given key value pair. |
453 | 453 | * |
454 | 454 | * @param string $key |
455 | - * @param mixed $operator |
|
455 | + * @param string $operator |
|
456 | 456 | * @param mixed $value |
457 | 457 | * @return static |
458 | 458 | */ |
@@ -578,7 +578,7 @@ discard block |
||
578 | 578 | * Get the first item from the collection. |
579 | 579 | * |
580 | 580 | * @param callable|null $callback |
581 | - * @param mixed $default |
|
581 | + * @param stdClass $default |
|
582 | 582 | * @return mixed |
583 | 583 | */ |
584 | 584 | public function first(callable $callback = null, $default = null) |
@@ -638,7 +638,7 @@ discard block |
||
638 | 638 | /** |
639 | 639 | * Get an item from the collection by key. |
640 | 640 | * |
641 | - * @param mixed $key |
|
641 | + * @param integer $key |
|
642 | 642 | * @param mixed $default |
643 | 643 | * @return mixed |
644 | 644 | */ |
@@ -1231,7 +1231,7 @@ discard block |
||
1231 | 1231 | /** |
1232 | 1232 | * Create a collection of all elements that do not pass a given truth test. |
1233 | 1233 | * |
1234 | - * @param callable|mixed $callback |
|
1234 | + * @param \Closure $callback |
|
1235 | 1235 | * @return static |
1236 | 1236 | */ |
1237 | 1237 | public function reject($callback) |
@@ -1783,7 +1783,7 @@ discard block |
||
1783 | 1783 | * Dynamically access collection proxies. |
1784 | 1784 | * |
1785 | 1785 | * @param string $key |
1786 | - * @return mixed |
|
1786 | + * @return HigherOrderCollectionProxy |
|
1787 | 1787 | * |
1788 | 1788 | * @throws \Exception |
1789 | 1789 | */ |
@@ -2,19 +2,19 @@ |
||
2 | 2 | |
3 | 3 | namespace IlluminateAgnostic\Collection\Support; |
4 | 4 | |
5 | -use stdClass; |
|
6 | -use Countable; |
|
7 | -use Exception; |
|
8 | 5 | use ArrayAccess; |
9 | -use Traversable; |
|
10 | 6 | use ArrayIterator; |
11 | 7 | use CachingIterator; |
12 | -use JsonSerializable; |
|
13 | -use IteratorAggregate; |
|
8 | +use Countable; |
|
9 | +use Exception; |
|
10 | +use IlluminateAgnostic\Collection\Contracts\Support\Arrayable; |
|
11 | +use IlluminateAgnostic\Collection\Contracts\Support\Jsonable; |
|
14 | 12 | use IlluminateAgnostic\Collection\Support\Debug\Dumper; |
15 | 13 | use IlluminateAgnostic\Collection\Support\Traits\Macroable; |
16 | -use IlluminateAgnostic\Collection\Contracts\Support\Jsonable; |
|
17 | -use IlluminateAgnostic\Collection\Contracts\Support\Arrayable; |
|
14 | +use IteratorAggregate; |
|
15 | +use JsonSerializable; |
|
16 | +use Traversable; |
|
17 | +use stdClass; |
|
18 | 18 | |
19 | 19 | class Collection implements ArrayAccess, Arrayable, Countable, IteratorAggregate, Jsonable, JsonSerializable |
20 | 20 | { |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | |
184 | 184 | $counts = new self; |
185 | 185 | |
186 | - $collection->each(function ($value) use ($counts) { |
|
186 | + $collection->each(function($value) use ($counts) { |
|
187 | 187 | $counts[$value] = isset($counts[$value]) ? $counts[$value] + 1 : 1; |
188 | 188 | }); |
189 | 189 | |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | |
192 | 192 | $highestValue = $sorted->last(); |
193 | 193 | |
194 | - return $sorted->filter(function ($value) use ($highestValue) { |
|
194 | + return $sorted->filter(function($value) use ($highestValue) { |
|
195 | 195 | return $value == $highestValue; |
196 | 196 | })->sort()->keys()->all(); |
197 | 197 | } |
@@ -239,13 +239,13 @@ discard block |
||
239 | 239 | public function containsStrict($key, $value = null) |
240 | 240 | { |
241 | 241 | if (func_num_args() == 2) { |
242 | - return $this->contains(function ($item) use ($key, $value) { |
|
242 | + return $this->contains(function($item) use ($key, $value) { |
|
243 | 243 | return data_get($item, $key) === $value; |
244 | 244 | }); |
245 | 245 | } |
246 | 246 | |
247 | 247 | if ($this->useAsCallable($key)) { |
248 | - return ! is_null($this->first($key)); |
|
248 | + return !is_null($this->first($key)); |
|
249 | 249 | } |
250 | 250 | |
251 | 251 | return in_array($key, $this->items, true); |
@@ -287,7 +287,7 @@ discard block |
||
287 | 287 | { |
288 | 288 | (new static(func_get_args())) |
289 | 289 | ->push($this) |
290 | - ->each(function ($item) { |
|
290 | + ->each(function($item) { |
|
291 | 291 | (new Dumper)->dump($item); |
292 | 292 | }); |
293 | 293 | |
@@ -352,7 +352,7 @@ discard block |
||
352 | 352 | */ |
353 | 353 | public function eachSpread(callable $callback) |
354 | 354 | { |
355 | - return $this->each(function ($chunk, $key) use ($callback) { |
|
355 | + return $this->each(function($chunk, $key) use ($callback) { |
|
356 | 356 | $chunk[] = $key; |
357 | 357 | |
358 | 358 | return $callback(...$chunk); |
@@ -373,7 +373,7 @@ discard block |
||
373 | 373 | $callback = $this->valueRetriever($key); |
374 | 374 | |
375 | 375 | foreach ($this->items as $k => $v) { |
376 | - if (! $callback($v, $k)) { |
|
376 | + if (!$callback($v, $k)) { |
|
377 | 377 | return false; |
378 | 378 | } |
379 | 379 | } |
@@ -394,7 +394,7 @@ discard block |
||
394 | 394 | { |
395 | 395 | if ($keys instanceof self) { |
396 | 396 | $keys = $keys->all(); |
397 | - } elseif (! is_array($keys)) { |
|
397 | + } elseif (!is_array($keys)) { |
|
398 | 398 | $keys = func_get_args(); |
399 | 399 | } |
400 | 400 | |
@@ -445,7 +445,7 @@ discard block |
||
445 | 445 | */ |
446 | 446 | public function unless($value, callable $callback, callable $default = null) |
447 | 447 | { |
448 | - return $this->when(! $value, $callback, $default); |
|
448 | + return $this->when(!$value, $callback, $default); |
|
449 | 449 | } |
450 | 450 | |
451 | 451 | /** |
@@ -477,10 +477,10 @@ discard block |
||
477 | 477 | $operator = '='; |
478 | 478 | } |
479 | 479 | |
480 | - return function ($item) use ($key, $operator, $value) { |
|
480 | + return function($item) use ($key, $operator, $value) { |
|
481 | 481 | $retrieved = data_get($item, $key); |
482 | 482 | |
483 | - $strings = array_filter([$retrieved, $value], function ($value) { |
|
483 | + $strings = array_filter([$retrieved, $value], function($value) { |
|
484 | 484 | return is_string($value) || (is_object($value) && method_exists($value, '__toString')); |
485 | 485 | }); |
486 | 486 | |
@@ -528,7 +528,7 @@ discard block |
||
528 | 528 | { |
529 | 529 | $values = $this->getArrayableItems($values); |
530 | 530 | |
531 | - return $this->filter(function ($item) use ($key, $values, $strict) { |
|
531 | + return $this->filter(function($item) use ($key, $values, $strict) { |
|
532 | 532 | return in_array(data_get($item, $key), $values, $strict); |
533 | 533 | }); |
534 | 534 | } |
@@ -557,7 +557,7 @@ discard block |
||
557 | 557 | { |
558 | 558 | $values = $this->getArrayableItems($values); |
559 | 559 | |
560 | - return $this->reject(function ($item) use ($key, $values, $strict) { |
|
560 | + return $this->reject(function($item) use ($key, $values, $strict) { |
|
561 | 561 | return in_array(data_get($item, $key), $values, $strict); |
562 | 562 | }); |
563 | 563 | } |
@@ -673,14 +673,14 @@ discard block |
||
673 | 673 | foreach ($this->items as $key => $value) { |
674 | 674 | $groupKeys = $groupBy($value, $key); |
675 | 675 | |
676 | - if (! is_array($groupKeys)) { |
|
676 | + if (!is_array($groupKeys)) { |
|
677 | 677 | $groupKeys = [$groupKeys]; |
678 | 678 | } |
679 | 679 | |
680 | 680 | foreach ($groupKeys as $groupKey) { |
681 | 681 | $groupKey = is_bool($groupKey) ? (int) $groupKey : $groupKey; |
682 | 682 | |
683 | - if (! array_key_exists($groupKey, $results)) { |
|
683 | + if (!array_key_exists($groupKey, $results)) { |
|
684 | 684 | $results[$groupKey] = new static; |
685 | 685 | } |
686 | 686 | |
@@ -690,7 +690,7 @@ discard block |
||
690 | 690 | |
691 | 691 | $result = new static($results); |
692 | 692 | |
693 | - if (! empty($nextGroups)) { |
|
693 | + if (!empty($nextGroups)) { |
|
694 | 694 | return $result->map->groupBy($nextGroups, $preserveKeys); |
695 | 695 | } |
696 | 696 | |
@@ -733,7 +733,7 @@ discard block |
||
733 | 733 | $keys = is_array($key) ? $key : func_get_args(); |
734 | 734 | |
735 | 735 | foreach ($keys as $value) { |
736 | - if (! $this->offsetExists($value)) { |
|
736 | + if (!$this->offsetExists($value)) { |
|
737 | 737 | return false; |
738 | 738 | } |
739 | 739 | } |
@@ -800,7 +800,7 @@ discard block |
||
800 | 800 | */ |
801 | 801 | public function isNotEmpty() |
802 | 802 | { |
803 | - return ! $this->isEmpty(); |
|
803 | + return !$this->isEmpty(); |
|
804 | 804 | } |
805 | 805 | |
806 | 806 | /** |
@@ -811,7 +811,7 @@ discard block |
||
811 | 811 | */ |
812 | 812 | protected function useAsCallable($value) |
813 | 813 | { |
814 | - return ! is_string($value) && is_callable($value); |
|
814 | + return !is_string($value) && is_callable($value); |
|
815 | 815 | } |
816 | 816 | |
817 | 817 | /** |
@@ -871,7 +871,7 @@ discard block |
||
871 | 871 | */ |
872 | 872 | public function mapSpread(callable $callback) |
873 | 873 | { |
874 | - return $this->map(function ($chunk, $key) use ($callback) { |
|
874 | + return $this->map(function($chunk, $key) use ($callback) { |
|
875 | 875 | $chunk[] = $key; |
876 | 876 | |
877 | 877 | return $callback(...$chunk); |
@@ -888,7 +888,7 @@ discard block |
||
888 | 888 | */ |
889 | 889 | public function mapToDictionary(callable $callback) |
890 | 890 | { |
891 | - $dictionary = $this->map($callback)->reduce(function ($groups, $pair) { |
|
891 | + $dictionary = $this->map($callback)->reduce(function($groups, $pair) { |
|
892 | 892 | $groups[key($pair)][] = reset($pair); |
893 | 893 | |
894 | 894 | return $groups; |
@@ -954,7 +954,7 @@ discard block |
||
954 | 954 | */ |
955 | 955 | public function mapInto($class) |
956 | 956 | { |
957 | - return $this->map(function ($value, $key) use ($class) { |
|
957 | + return $this->map(function($value, $key) use ($class) { |
|
958 | 958 | return new $class($value, $key); |
959 | 959 | }); |
960 | 960 | } |
@@ -969,9 +969,9 @@ discard block |
||
969 | 969 | { |
970 | 970 | $callback = $this->valueRetriever($callback); |
971 | 971 | |
972 | - return $this->filter(function ($value) { |
|
973 | - return ! is_null($value); |
|
974 | - })->reduce(function ($result, $item) use ($callback) { |
|
972 | + return $this->filter(function($value) { |
|
973 | + return !is_null($value); |
|
974 | + })->reduce(function($result, $item) use ($callback) { |
|
975 | 975 | $value = $callback($item); |
976 | 976 | |
977 | 977 | return is_null($result) || $value > $result ? $value : $result; |
@@ -1021,9 +1021,9 @@ discard block |
||
1021 | 1021 | { |
1022 | 1022 | $callback = $this->valueRetriever($callback); |
1023 | 1023 | |
1024 | - return $this->filter(function ($value) { |
|
1025 | - return ! is_null($value); |
|
1026 | - })->reduce(function ($result, $item) use ($callback) { |
|
1024 | + return $this->filter(function($value) { |
|
1025 | + return !is_null($value); |
|
1026 | + })->reduce(function($result, $item) use ($callback) { |
|
1027 | 1027 | $value = $callback($item); |
1028 | 1028 | |
1029 | 1029 | return is_null($result) || $value < $result ? $value : $result; |
@@ -1102,7 +1102,7 @@ discard block |
||
1102 | 1102 | $callback = $this->valueRetriever($callback); |
1103 | 1103 | |
1104 | 1104 | foreach ($this->items as $key => $item) { |
1105 | - $partitions[(int) ! $callback($item, $key)][$key] = $item; |
|
1105 | + $partitions[(int) !$callback($item, $key)][$key] = $item; |
|
1106 | 1106 | } |
1107 | 1107 | |
1108 | 1108 | return new static($partitions); |
@@ -1237,12 +1237,12 @@ discard block |
||
1237 | 1237 | public function reject($callback) |
1238 | 1238 | { |
1239 | 1239 | if ($this->useAsCallable($callback)) { |
1240 | - return $this->filter(function ($value, $key) use ($callback) { |
|
1241 | - return ! $callback($value, $key); |
|
1240 | + return $this->filter(function($value, $key) use ($callback) { |
|
1241 | + return !$callback($value, $key); |
|
1242 | 1242 | }); |
1243 | 1243 | } |
1244 | 1244 | |
1245 | - return $this->filter(function ($item) use ($callback) { |
|
1245 | + return $this->filter(function($item) use ($callback) { |
|
1246 | 1246 | return $item != $callback; |
1247 | 1247 | }); |
1248 | 1248 | } |
@@ -1266,7 +1266,7 @@ discard block |
||
1266 | 1266 | */ |
1267 | 1267 | public function search($value, $strict = false) |
1268 | 1268 | { |
1269 | - if (! $this->useAsCallable($value)) { |
|
1269 | + if (!$this->useAsCallable($value)) { |
|
1270 | 1270 | return array_search($value, $this->items, $strict); |
1271 | 1271 | } |
1272 | 1272 | |
@@ -1304,7 +1304,7 @@ discard block |
||
1304 | 1304 | } else { |
1305 | 1305 | srand($seed); |
1306 | 1306 | |
1307 | - usort($items, function () { |
|
1307 | + usort($items, function() { |
|
1308 | 1308 | return rand(-1, 1); |
1309 | 1309 | }); |
1310 | 1310 | } |
@@ -1456,7 +1456,7 @@ discard block |
||
1456 | 1456 | |
1457 | 1457 | $callback = $this->valueRetriever($callback); |
1458 | 1458 | |
1459 | - return $this->reduce(function ($result, $item) use ($callback) { |
|
1459 | + return $this->reduce(function($result, $item) use ($callback) { |
|
1460 | 1460 | return $result + $callback($item); |
1461 | 1461 | }, 0); |
1462 | 1462 | } |
@@ -1519,7 +1519,7 @@ discard block |
||
1519 | 1519 | |
1520 | 1520 | $exists = []; |
1521 | 1521 | |
1522 | - return $this->reject(function ($item, $key) use ($callback, $strict, &$exists) { |
|
1522 | + return $this->reject(function($item, $key) use ($callback, $strict, &$exists) { |
|
1523 | 1523 | if (in_array($id = $callback($item, $key), $exists, $strict)) { |
1524 | 1524 | return true; |
1525 | 1525 | } |
@@ -1561,7 +1561,7 @@ discard block |
||
1561 | 1561 | return $value; |
1562 | 1562 | } |
1563 | 1563 | |
1564 | - return function ($item) use ($value) { |
|
1564 | + return function($item) use ($value) { |
|
1565 | 1565 | return data_get($item, $value); |
1566 | 1566 | }; |
1567 | 1567 | } |
@@ -1577,11 +1577,11 @@ discard block |
||
1577 | 1577 | */ |
1578 | 1578 | public function zip($items) |
1579 | 1579 | { |
1580 | - $arrayableItems = array_map(function ($items) { |
|
1580 | + $arrayableItems = array_map(function($items) { |
|
1581 | 1581 | return $this->getArrayableItems($items); |
1582 | 1582 | }, func_get_args()); |
1583 | 1583 | |
1584 | - $params = array_merge([function () { |
|
1584 | + $params = array_merge([function() { |
|
1585 | 1585 | return new static(func_get_args()); |
1586 | 1586 | }, $this->items], $arrayableItems); |
1587 | 1587 | |
@@ -1607,7 +1607,7 @@ discard block |
||
1607 | 1607 | */ |
1608 | 1608 | public function toArray() |
1609 | 1609 | { |
1610 | - return array_map(function ($value) { |
|
1610 | + return array_map(function($value) { |
|
1611 | 1611 | return $value instanceof Arrayable ? $value->toArray() : $value; |
1612 | 1612 | }, $this->items); |
1613 | 1613 | } |
@@ -1619,7 +1619,7 @@ discard block |
||
1619 | 1619 | */ |
1620 | 1620 | public function jsonSerialize() |
1621 | 1621 | { |
1622 | - return array_map(function ($value) { |
|
1622 | + return array_map(function($value) { |
|
1623 | 1623 | if ($value instanceof JsonSerializable) { |
1624 | 1624 | return $value->jsonSerialize(); |
1625 | 1625 | } elseif ($value instanceof Jsonable) { |
@@ -1789,7 +1789,7 @@ discard block |
||
1789 | 1789 | */ |
1790 | 1790 | public function __get($key) |
1791 | 1791 | { |
1792 | - if (! in_array($key, static::$proxies)) { |
|
1792 | + if (!in_array($key, static::$proxies)) { |
|
1793 | 1793 | throw new Exception("Property [{$key}] does not exist on this collection instance."); |
1794 | 1794 | } |
1795 | 1795 |
@@ -94,7 +94,7 @@ |
||
94 | 94 | * Determine if a given string contains a given substring. |
95 | 95 | * |
96 | 96 | * @param string $haystack |
97 | - * @param string|array $needles |
|
97 | + * @param string $needles |
|
98 | 98 | * @return bool |
99 | 99 | */ |
100 | 100 | public static function contains($haystack, $needles) |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | { |
53 | 53 | $languageSpecific = static::languageSpecificCharsArray($language); |
54 | 54 | |
55 | - if (! is_null($languageSpecific)) { |
|
55 | + if (!is_null($languageSpecific)) { |
|
56 | 56 | $value = str_replace($languageSpecific[0], $languageSpecific[1], $value); |
57 | 57 | } |
58 | 58 | |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | { |
246 | 246 | preg_match('/^\s*+(?:\S++\s*+){1,'.$words.'}/u', $value, $matches); |
247 | 247 | |
248 | - if (! isset($matches[0]) || static::length($value) === static::length($matches[0])) { |
|
248 | + if (!isset($matches[0]) || static::length($value) === static::length($matches[0])) { |
|
249 | 249 | return $value; |
250 | 250 | } |
251 | 251 | |
@@ -447,7 +447,7 @@ discard block |
||
447 | 447 | return static::$snakeCache[$key][$delimiter]; |
448 | 448 | } |
449 | 449 | |
450 | - if (! ctype_lower($value)) { |
|
450 | + if (!ctype_lower($value)) { |
|
451 | 451 | $value = preg_replace('/\s+/u', '', ucwords($value)); |
452 | 452 | |
453 | 453 | $value = static::lower(preg_replace('/(.)(?=[A-Z])/u', '$1'.$delimiter, $value)); |
@@ -665,14 +665,14 @@ discard block |
||
665 | 665 | { |
666 | 666 | static $languageSpecific; |
667 | 667 | |
668 | - if (! isset($languageSpecific)) { |
|
668 | + if (!isset($languageSpecific)) { |
|
669 | 669 | $languageSpecific = [ |
670 | 670 | 'bg' => [ |
671 | 671 | ['х', 'Х', 'щ', 'Щ', 'ъ', 'Ъ', 'ь', 'Ь'], |
672 | 672 | ['h', 'H', 'sht', 'SHT', 'a', 'А', 'y', 'Y'], |
673 | 673 | ], |
674 | 674 | 'de' => [ |
675 | - ['ä', 'ö', 'ü', 'Ä', 'Ö', 'Ü'], |
|
675 | + ['ä', 'ö', 'ü', 'Ä', 'Ö', 'Ü'], |
|
676 | 676 | ['ae', 'oe', 'ue', 'AE', 'OE', 'UE'], |
677 | 677 | ], |
678 | 678 | ]; |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | */ |
43 | 43 | public function __get($key) |
44 | 44 | { |
45 | - return $this->collection->{$this->method}(function ($value) use ($key) { |
|
45 | + return $this->collection->{$this->method}(function($value) use ($key) { |
|
46 | 46 | return is_array($value) ? $value[$key] : $value->{$key}; |
47 | 47 | }); |
48 | 48 | } |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | */ |
57 | 57 | public function __call($method, $parameters) |
58 | 58 | { |
59 | - return $this->collection->{$this->method}(function ($value) use ($method, $parameters) { |
|
59 | + return $this->collection->{$this->method}(function($value) use ($method, $parameters) { |
|
60 | 60 | return $value->{$method}(...$parameters); |
61 | 61 | }); |
62 | 62 | } |
@@ -30,7 +30,7 @@ |
||
30 | 30 | |
31 | 31 | $carbon = $this; |
32 | 32 | |
33 | - return call_user_func(function () use ($carbon) { |
|
33 | + return call_user_func(function() use ($carbon) { |
|
34 | 34 | return get_object_vars($carbon); |
35 | 35 | }); |
36 | 36 | } |
@@ -70,7 +70,7 @@ discard block |
||
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 | |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | */ |
93 | 93 | public function __call($method, $parameters) |
94 | 94 | { |
95 | - if (! static::hasMacro($method)) { |
|
95 | + if (!static::hasMacro($method)) { |
|
96 | 96 | throw new BadMethodCallException("Method {$method} does not exist."); |
97 | 97 | } |
98 | 98 |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | foreach ($array as $values) { |
52 | 52 | if ($values instanceof Collection) { |
53 | 53 | $values = $values->all(); |
54 | - } elseif (! is_array($values)) { |
|
54 | + } elseif (!is_array($values)) { |
|
55 | 55 | continue; |
56 | 56 | } |
57 | 57 | |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | $results = []; |
112 | 112 | |
113 | 113 | foreach ($array as $key => $value) { |
114 | - if (is_array($value) && ! empty($value)) { |
|
114 | + if (is_array($value) && !empty($value)) { |
|
115 | 115 | $results = array_merge($results, static::dot($value, $prepend.$key.'.')); |
116 | 116 | } else { |
117 | 117 | $results[$prepend.$key] = $value; |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | foreach ($array as $item) { |
212 | 212 | $item = $item instanceof Collection ? $item->all() : $item; |
213 | 213 | |
214 | - if (! is_array($item)) { |
|
214 | + if (!is_array($item)) { |
|
215 | 215 | $result[] = $item; |
216 | 216 | } elseif ($depth === 1) { |
217 | 217 | $result = array_merge($result, array_values($item)); |
@@ -277,7 +277,7 @@ discard block |
||
277 | 277 | */ |
278 | 278 | public static function get($array, $key, $default = null) |
279 | 279 | { |
280 | - if (! static::accessible($array)) { |
|
280 | + if (!static::accessible($array)) { |
|
281 | 281 | return value($default); |
282 | 282 | } |
283 | 283 | |
@@ -319,7 +319,7 @@ discard block |
||
319 | 319 | |
320 | 320 | $keys = (array) $keys; |
321 | 321 | |
322 | - if (! $array) { |
|
322 | + if (!$array) { |
|
323 | 323 | return false; |
324 | 324 | } |
325 | 325 | |
@@ -525,7 +525,7 @@ discard block |
||
525 | 525 | // If the key doesn't exist at this depth, we will just create an empty array |
526 | 526 | // to hold the next value, allowing us to create the arrays to hold final |
527 | 527 | // values at the correct depth. Then we'll keep digging into the array. |
528 | - if (! isset($array[$key]) || ! is_array($array[$key])) { |
|
528 | + if (!isset($array[$key]) || !is_array($array[$key])) { |
|
529 | 529 | $array[$key] = []; |
530 | 530 | } |
531 | 531 | |
@@ -605,6 +605,6 @@ discard block |
||
605 | 605 | */ |
606 | 606 | public static function wrap($value) |
607 | 607 | { |
608 | - return ! is_array($value) ? [$value] : $value; |
|
608 | + return !is_array($value) ? [$value] : $value; |
|
609 | 609 | } |
610 | 610 | } |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | use IlluminateAgnostic\Collection\Support\Debug\Dumper; |
7 | 7 | use Illuminate\Support\Collection as IlluminateCollection; |
8 | 8 | |
9 | -if (! function_exists('array_wrap')) { |
|
9 | +if (!function_exists('array_wrap')) { |
|
10 | 10 | /** |
11 | 11 | * If the given value is not an array, wrap it in one. |
12 | 12 | * |
@@ -15,11 +15,11 @@ discard block |
||
15 | 15 | */ |
16 | 16 | function array_wrap($value) |
17 | 17 | { |
18 | - return ! is_array($value) ? [$value] : $value; |
|
18 | + return !is_array($value) ? [$value] : $value; |
|
19 | 19 | } |
20 | 20 | } |
21 | 21 | |
22 | -if (! function_exists('collect')) { |
|
22 | +if (!function_exists('collect')) { |
|
23 | 23 | /** |
24 | 24 | * Create a collection from the given value. |
25 | 25 | * |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | } |
37 | 37 | } |
38 | 38 | |
39 | -if (! function_exists('value')) { |
|
39 | +if (!function_exists('value')) { |
|
40 | 40 | /** |
41 | 41 | * Return the default value of the given value. |
42 | 42 | * |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | } |
50 | 50 | } |
51 | 51 | |
52 | -if (! function_exists('data_get')) { |
|
52 | +if (!function_exists('data_get')) { |
|
53 | 53 | /** |
54 | 54 | * Get an item from an array or object using "dot" notation. |
55 | 55 | * |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | if ($segment === '*') { |
71 | 71 | if ($target instanceof Collection) { |
72 | 72 | $target = $target->all(); |
73 | - } elseif (! is_array($target)) { |
|
73 | + } elseif (!is_array($target)) { |
|
74 | 74 | return value($default); |
75 | 75 | } |
76 | 76 | |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | } |
93 | 93 | } |
94 | 94 | |
95 | -if (! function_exists('with')) { |
|
95 | +if (!function_exists('with')) { |
|
96 | 96 | /** |
97 | 97 | * Return the given object. Useful for chaining. |
98 | 98 | * |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | } |
106 | 106 | } |
107 | 107 | |
108 | -if (! function_exists('dd')) { |
|
108 | +if (!function_exists('dd')) { |
|
109 | 109 | /** |
110 | 110 | * Dump the passed variables and end the script. |
111 | 111 | * |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | } |
122 | 122 | } |
123 | 123 | |
124 | -if (! function_exists('studly_case')) { |
|
124 | +if (!function_exists('studly_case')) { |
|
125 | 125 | /** |
126 | 126 | * Convert a value to studly caps case. |
127 | 127 | * |
@@ -14,7 +14,7 @@ |
||
14 | 14 | ]; |
15 | 15 | |
16 | 16 | foreach ($aliases as $illuminate => $tighten) { |
17 | - if (class_exists($illuminate) && ! interface_exists($illuminate) && ! trait_exists($illuminate)) { |
|
17 | + if (class_exists($illuminate) && !interface_exists($illuminate) && !trait_exists($illuminate)) { |
|
18 | 18 | class_alias($illuminate, $tighten); |
19 | 19 | } |
20 | 20 | } |