@@ 64-80 (lines=17) @@ | ||
61 | }); |
|
62 | } |
|
63 | ||
64 | if (! Collection::hasMacro('range')) { |
|
65 | /* |
|
66 | * Create a new collection instance with a range of numbers. `range` |
|
67 | * accepts the same parameters as PHP's standard `range` function. |
|
68 | * |
|
69 | * @see range |
|
70 | * |
|
71 | * @param mixed $start |
|
72 | * @param mixed $end |
|
73 | * @param int|float $step |
|
74 | * |
|
75 | * @return \Illuminate\Support\Collection |
|
76 | */ |
|
77 | Collection::macro('range', function ($start, $end, $step = 1): Collection { |
|
78 | return new Collection(range($start, $end, $step)); |
|
79 | }); |
|
80 | } |
|
81 | ||
82 | if (! Collection::hasMacro('withSize')) { |
|
83 | /* |
|
@@ 82-97 (lines=16) @@ | ||
79 | }); |
|
80 | } |
|
81 | ||
82 | if (! Collection::hasMacro('withSize')) { |
|
83 | /* |
|
84 | * Create a new collection with the specified amount of items |
|
85 | * |
|
86 | * @param int $size |
|
87 | * |
|
88 | * @return \Illuminate\Support\Collection |
|
89 | */ |
|
90 | Collection::macro('withSize', function (int $size): Collection { |
|
91 | if ($size < 1) { |
|
92 | return new Collection(); |
|
93 | } |
|
94 | ||
95 | return new Collection(range(1, $size)); |
|
96 | }); |
|
97 | } |
|
98 | ||
99 | if (! Collection::hasMacro('none')) { |
|
100 | /* |