Subversion-Projekte lars-tiefland.laravel_shop

Revision

Revision 150 | Zur aktuellen Revision | Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
148 lars 1
<?php
2
 
3
namespace Illuminate\Support;
4
 
5
use CachingIterator;
6
use Countable;
7
use Illuminate\Contracts\Support\Arrayable;
8
use Illuminate\Contracts\Support\Jsonable;
9
use IteratorAggregate;
10
use JsonSerializable;
11
use Traversable;
12
 
13
/**
14
 * @template TKey of array-key
15
 * @template TValue
16
 *
17
 * @extends \Illuminate\Contracts\Support\Arrayable<TKey, TValue>
18
 * @extends \IteratorAggregate<TKey, TValue>
19
 */
20
interface Enumerable extends Arrayable, Countable, IteratorAggregate, Jsonable, JsonSerializable
21
{
22
    /**
23
     * Create a new collection instance if the value isn't one already.
24
     *
25
     * @template TMakeKey of array-key
26
     * @template TMakeValue
27
     *
28
     * @param  \Illuminate\Contracts\Support\Arrayable<TMakeKey, TMakeValue>|iterable<TMakeKey, TMakeValue>|null  $items
29
     * @return static<TMakeKey, TMakeValue>
30
     */
31
    public static function make($items = []);
32
 
33
    /**
34
     * Create a new instance by invoking the callback a given amount of times.
35
     *
36
     * @param  int  $number
37
     * @param  callable|null  $callback
38
     * @return static
39
     */
40
    public static function times($number, callable $callback = null);
41
 
42
    /**
43
     * Create a collection with the given range.
44
     *
45
     * @param  int  $from
46
     * @param  int  $to
47
     * @return static
48
     */
49
    public static function range($from, $to);
50
 
51
    /**
52
     * Wrap the given value in a collection if applicable.
53
     *
54
     * @template TWrapKey of array-key
55
     * @template TWrapValue
56
     *
57
     * @param  iterable<TWrapKey, TWrapValue>  $value
58
     * @return static<TWrapKey, TWrapValue>
59
     */
60
    public static function wrap($value);
61
 
62
    /**
63
     * Get the underlying items from the given collection if applicable.
64
     *
65
     * @template TUnwrapKey of array-key
66
     * @template TUnwrapValue
67
     *
68
     * @param  array<TUnwrapKey, TUnwrapValue>|static<TUnwrapKey, TUnwrapValue>  $value
69
     * @return array<TUnwrapKey, TUnwrapValue>
70
     */
71
    public static function unwrap($value);
72
 
73
    /**
74
     * Create a new instance with no items.
75
     *
76
     * @return static
77
     */
78
    public static function empty();
79
 
80
    /**
81
     * Get all items in the enumerable.
82
     *
83
     * @return array
84
     */
85
    public function all();
86
 
87
    /**
88
     * Alias for the "avg" method.
89
     *
90
     * @param  (callable(TValue): float|int)|string|null  $callback
91
     * @return float|int|null
92
     */
93
    public function average($callback = null);
94
 
95
    /**
96
     * Get the median of a given key.
97
     *
98
     * @param  string|array<array-key, string>|null  $key
99
     * @return float|int|null
100
     */
101
    public function median($key = null);
102
 
103
    /**
104
     * Get the mode of a given key.
105
     *
106
     * @param  string|array<array-key, string>|null  $key
107
     * @return array<int, float|int>|null
108
     */
109
    public function mode($key = null);
110
 
111
    /**
112
     * Collapse the items into a single enumerable.
113
     *
114
     * @return static<int, mixed>
115
     */
116
    public function collapse();
117
 
118
    /**
119
     * Alias for the "contains" method.
120
     *
121
     * @param  (callable(TValue, TKey): bool)|TValue|string  $key
122
     * @param  mixed  $operator
123
     * @param  mixed  $value
124
     * @return bool
125
     */
126
    public function some($key, $operator = null, $value = null);
127
 
128
    /**
129
     * Determine if an item exists, using strict comparison.
130
     *
131
     * @param  (callable(TValue): bool)|TValue|array-key  $key
132
     * @param  TValue|null  $value
133
     * @return bool
134
     */
135
    public function containsStrict($key, $value = null);
136
 
137
    /**
138
     * Get the average value of a given key.
139
     *
140
     * @param  (callable(TValue): float|int)|string|null  $callback
141
     * @return float|int|null
142
     */
143
    public function avg($callback = null);
144
 
145
    /**
146
     * Determine if an item exists in the enumerable.
147
     *
148
     * @param  (callable(TValue, TKey): bool)|TValue|string  $key
149
     * @param  mixed  $operator
150
     * @param  mixed  $value
151
     * @return bool
152
     */
153
    public function contains($key, $operator = null, $value = null);
154
 
155
    /**
156
     * Determine if an item is not contained in the collection.
157
     *
158
     * @param  mixed  $key
159
     * @param  mixed  $operator
160
     * @param  mixed  $value
161
     * @return bool
162
     */
163
    public function doesntContain($key, $operator = null, $value = null);
164
 
165
    /**
166
     * Cross join with the given lists, returning all possible permutations.
167
     *
168
     * @template TCrossJoinKey
169
     * @template TCrossJoinValue
170
     *
171
     * @param  \Illuminate\Contracts\Support\Arrayable<TCrossJoinKey, TCrossJoinValue>|iterable<TCrossJoinKey, TCrossJoinValue>  ...$lists
172
     * @return static<int, array<int, TValue|TCrossJoinValue>>
173
     */
174
    public function crossJoin(...$lists);
175
 
176
    /**
177
     * Dump the collection and end the script.
178
     *
179
     * @param  mixed  ...$args
180
     * @return never
181
     */
182
    public function dd(...$args);
183
 
184
    /**
185
     * Dump the collection.
186
     *
187
     * @return $this
188
     */
189
    public function dump();
190
 
191
    /**
192
     * Get the items that are not present in the given items.
193
     *
194
     * @param  \Illuminate\Contracts\Support\Arrayable<array-key, TValue>|iterable<array-key, TValue>  $items
195
     * @return static
196
     */
197
    public function diff($items);
198
 
199
    /**
200
     * Get the items that are not present in the given items, using the callback.
201
     *
202
     * @param  \Illuminate\Contracts\Support\Arrayable<array-key, TValue>|iterable<array-key, TValue>  $items
203
     * @param  callable(TValue, TValue): int  $callback
204
     * @return static
205
     */
206
    public function diffUsing($items, callable $callback);
207
 
208
    /**
209
     * Get the items whose keys and values are not present in the given items.
210
     *
211
     * @param  \Illuminate\Contracts\Support\Arrayable<TKey, TValue>|iterable<TKey, TValue>  $items
212
     * @return static
213
     */
214
    public function diffAssoc($items);
215
 
216
    /**
217
     * Get the items whose keys and values are not present in the given items, using the callback.
218
     *
219
     * @param  \Illuminate\Contracts\Support\Arrayable<TKey, TValue>|iterable<TKey, TValue>  $items
220
     * @param  callable(TKey, TKey): int  $callback
221
     * @return static
222
     */
223
    public function diffAssocUsing($items, callable $callback);
224
 
225
    /**
226
     * Get the items whose keys are not present in the given items.
227
     *
228
     * @param  \Illuminate\Contracts\Support\Arrayable<TKey, TValue>|iterable<TKey, TValue>  $items
229
     * @return static
230
     */
231
    public function diffKeys($items);
232
 
233
    /**
234
     * Get the items whose keys are not present in the given items, using the callback.
235
     *
236
     * @param  \Illuminate\Contracts\Support\Arrayable<TKey, TValue>|iterable<TKey, TValue>  $items
237
     * @param  callable(TKey, TKey): int  $callback
238
     * @return static
239
     */
240
    public function diffKeysUsing($items, callable $callback);
241
 
242
    /**
243
     * Retrieve duplicate items.
244
     *
245
     * @param  (callable(TValue): bool)|string|null  $callback
246
     * @param  bool  $strict
247
     * @return static
248
     */
249
    public function duplicates($callback = null, $strict = false);
250
 
251
    /**
252
     * Retrieve duplicate items using strict comparison.
253
     *
254
     * @param  (callable(TValue): bool)|string|null  $callback
255
     * @return static
256
     */
257
    public function duplicatesStrict($callback = null);
258
 
259
    /**
260
     * Execute a callback over each item.
261
     *
262
     * @param  callable(TValue, TKey): mixed  $callback
263
     * @return $this
264
     */
265
    public function each(callable $callback);
266
 
267
    /**
268
     * Execute a callback over each nested chunk of items.
269
     *
270
     * @param  callable  $callback
271
     * @return static
272
     */
273
    public function eachSpread(callable $callback);
274
 
275
    /**
276
     * Determine if all items pass the given truth test.
277
     *
278
     * @param  (callable(TValue, TKey): bool)|TValue|string  $key
279
     * @param  mixed  $operator
280
     * @param  mixed  $value
281
     * @return bool
282
     */
283
    public function every($key, $operator = null, $value = null);
284
 
285
    /**
286
     * Get all items except for those with the specified keys.
287
     *
288
     * @param  \Illuminate\Support\Enumerable<array-key, TKey>|array<array-key, TKey>  $keys
289
     * @return static
290
     */
291
    public function except($keys);
292
 
293
    /**
294
     * Run a filter over each of the items.
295
     *
296
     * @param  (callable(TValue): bool)|null  $callback
297
     * @return static
298
     */
299
    public function filter(callable $callback = null);
300
 
301
    /**
302
     * Apply the callback if the given "value" is (or resolves to) truthy.
303
     *
304
     * @template TWhenReturnType as null
305
     *
306
     * @param  bool  $value
307
     * @param  (callable($this): TWhenReturnType)|null  $callback
308
     * @param  (callable($this): TWhenReturnType)|null  $default
309
     * @return $this|TWhenReturnType
310
     */
311
    public function when($value, callable $callback = null, callable $default = null);
312
 
313
    /**
314
     * Apply the callback if the collection is empty.
315
     *
316
     * @template TWhenEmptyReturnType
317
     *
318
     * @param  (callable($this): TWhenEmptyReturnType)  $callback
319
     * @param  (callable($this): TWhenEmptyReturnType)|null  $default
320
     * @return $this|TWhenEmptyReturnType
321
     */
322
    public function whenEmpty(callable $callback, callable $default = null);
323
 
324
    /**
325
     * Apply the callback if the collection is not empty.
326
     *
327
     * @template TWhenNotEmptyReturnType
328
     *
329
     * @param  callable($this): TWhenNotEmptyReturnType  $callback
330
     * @param  (callable($this): TWhenNotEmptyReturnType)|null  $default
331
     * @return $this|TWhenNotEmptyReturnType
332
     */
333
    public function whenNotEmpty(callable $callback, callable $default = null);
334
 
335
    /**
336
     * Apply the callback if the given "value" is (or resolves to) truthy.
337
     *
338
     * @template TUnlessReturnType
339
     *
340
     * @param  bool  $value
341
     * @param  (callable($this): TUnlessReturnType)  $callback
342
     * @param  (callable($this): TUnlessReturnType)|null  $default
343
     * @return $this|TUnlessReturnType
344
     */
345
    public function unless($value, callable $callback, callable $default = null);
346
 
347
    /**
348
     * Apply the callback unless the collection is empty.
349
     *
350
     * @template TUnlessEmptyReturnType
351
     *
352
     * @param  callable($this): TUnlessEmptyReturnType  $callback
353
     * @param  (callable($this): TUnlessEmptyReturnType)|null  $default
354
     * @return $this|TUnlessEmptyReturnType
355
     */
356
    public function unlessEmpty(callable $callback, callable $default = null);
357
 
358
    /**
359
     * Apply the callback unless the collection is not empty.
360
     *
361
     * @template TUnlessNotEmptyReturnType
362
     *
363
     * @param  callable($this): TUnlessNotEmptyReturnType  $callback
364
     * @param  (callable($this): TUnlessNotEmptyReturnType)|null  $default
365
     * @return $this|TUnlessNotEmptyReturnType
366
     */
367
    public function unlessNotEmpty(callable $callback, callable $default = null);
368
 
369
    /**
370
     * Filter items by the given key value pair.
371
     *
372
     * @param  string  $key
373
     * @param  mixed  $operator
374
     * @param  mixed  $value
375
     * @return static
376
     */
377
    public function where($key, $operator = null, $value = null);
378
 
379
    /**
380
     * Filter items where the value for the given key is null.
381
     *
382
     * @param  string|null  $key
383
     * @return static
384
     */
385
    public function whereNull($key = null);
386
 
387
    /**
388
     * Filter items where the value for the given key is not null.
389
     *
390
     * @param  string|null  $key
391
     * @return static
392
     */
393
    public function whereNotNull($key = null);
394
 
395
    /**
396
     * Filter items by the given key value pair using strict comparison.
397
     *
398
     * @param  string  $key
399
     * @param  mixed  $value
400
     * @return static
401
     */
402
    public function whereStrict($key, $value);
403
 
404
    /**
405
     * Filter items by the given key value pair.
406
     *
407
     * @param  string  $key
408
     * @param  \Illuminate\Contracts\Support\Arrayable|iterable  $values
409
     * @param  bool  $strict
410
     * @return static
411
     */
412
    public function whereIn($key, $values, $strict = false);
413
 
414
    /**
415
     * Filter items by the given key value pair using strict comparison.
416
     *
417
     * @param  string  $key
418
     * @param  \Illuminate\Contracts\Support\Arrayable|iterable  $values
419
     * @return static
420
     */
421
    public function whereInStrict($key, $values);
422
 
423
    /**
424
     * Filter items such that the value of the given key is between the given values.
425
     *
426
     * @param  string  $key
427
     * @param  \Illuminate\Contracts\Support\Arrayable|iterable  $values
428
     * @return static
429
     */
430
    public function whereBetween($key, $values);
431
 
432
    /**
433
     * Filter items such that the value of the given key is not between the given values.
434
     *
435
     * @param  string  $key
436
     * @param  \Illuminate\Contracts\Support\Arrayable|iterable  $values
437
     * @return static
438
     */
439
    public function whereNotBetween($key, $values);
440
 
441
    /**
442
     * Filter items by the given key value pair.
443
     *
444
     * @param  string  $key
445
     * @param  \Illuminate\Contracts\Support\Arrayable|iterable  $values
446
     * @param  bool  $strict
447
     * @return static
448
     */
449
    public function whereNotIn($key, $values, $strict = false);
450
 
451
    /**
452
     * Filter items by the given key value pair using strict comparison.
453
     *
454
     * @param  string  $key
455
     * @param  \Illuminate\Contracts\Support\Arrayable|iterable  $values
456
     * @return static
457
     */
458
    public function whereNotInStrict($key, $values);
459
 
460
    /**
461
     * Filter the items, removing any items that don't match the given type(s).
462
     *
463
     * @template TWhereInstanceOf
464
     *
465
     * @param  class-string<TWhereInstanceOf>|array<array-key, class-string<TWhereInstanceOf>>  $type
466
     * @return static<TKey, TWhereInstanceOf>
467
     */
468
    public function whereInstanceOf($type);
469
 
470
    /**
471
     * Get the first item from the enumerable passing the given truth test.
472
     *
473
     * @template TFirstDefault
474
     *
475
     * @param  (callable(TValue,TKey): bool)|null  $callback
476
     * @param  TFirstDefault|(\Closure(): TFirstDefault)  $default
477
     * @return TValue|TFirstDefault
478
     */
479
    public function first(callable $callback = null, $default = null);
480
 
481
    /**
482
     * Get the first item by the given key value pair.
483
     *
484
     * @param  string  $key
485
     * @param  mixed  $operator
486
     * @param  mixed  $value
487
     * @return TValue|null
488
     */
489
    public function firstWhere($key, $operator = null, $value = null);
490
 
491
    /**
492
     * Get a flattened array of the items in the collection.
493
     *
494
     * @param  int  $depth
495
     * @return static
496
     */
497
    public function flatten($depth = INF);
498
 
499
    /**
500
     * Flip the values with their keys.
501
     *
502
     * @return static<TValue, TKey>
503
     */
504
    public function flip();
505
 
506
    /**
507
     * Get an item from the collection by key.
508
     *
509
     * @template TGetDefault
510
     *
511
     * @param  TKey  $key
512
     * @param  TGetDefault|(\Closure(): TGetDefault)  $default
513
     * @return TValue|TGetDefault
514
     */
515
    public function get($key, $default = null);
516
 
517
    /**
518
     * Group an associative array by a field or using a callback.
519
     *
520
     * @param  (callable(TValue, TKey): array-key)|array|string  $groupBy
521
     * @param  bool  $preserveKeys
522
     * @return static<array-key, static<array-key, TValue>>
523
     */
524
    public function groupBy($groupBy, $preserveKeys = false);
525
 
526
    /**
527
     * Key an associative array by a field or using a callback.
528
     *
529
     * @param  (callable(TValue, TKey): array-key)|array|string  $keyBy
530
     * @return static<array-key, TValue>
531
     */
532
    public function keyBy($keyBy);
533
 
534
    /**
535
     * Determine if an item exists in the collection by key.
536
     *
537
     * @param  TKey|array<array-key, TKey>  $key
538
     * @return bool
539
     */
540
    public function has($key);
541
 
542
    /**
543
     * Determine if any of the keys exist in the collection.
544
     *
545
     * @param  mixed  $key
546
     * @return bool
547
     */
548
    public function hasAny($key);
549
 
550
    /**
551
     * Concatenate values of a given key as a string.
552
     *
553
     * @param  string  $value
554
     * @param  string|null  $glue
555
     * @return string
556
     */
557
    public function implode($value, $glue = null);
558
 
559
    /**
560
     * Intersect the collection with the given items.
561
     *
562
     * @param  \Illuminate\Contracts\Support\Arrayable<TKey, TValue>|iterable<TKey, TValue>  $items
563
     * @return static
564
     */
565
    public function intersect($items);
566
 
567
    /**
568
     * Intersect the collection with the given items by key.
569
     *
570
     * @param  \Illuminate\Contracts\Support\Arrayable<TKey, TValue>|iterable<TKey, TValue>  $items
571
     * @return static
572
     */
573
    public function intersectByKeys($items);
574
 
575
    /**
576
     * Determine if the collection is empty or not.
577
     *
578
     * @return bool
579
     */
580
    public function isEmpty();
581
 
582
    /**
583
     * Determine if the collection is not empty.
584
     *
585
     * @return bool
586
     */
587
    public function isNotEmpty();
588
 
589
    /**
590
     * Determine if the collection contains a single item.
591
     *
592
     * @return bool
593
     */
594
    public function containsOneItem();
595
 
596
    /**
597
     * Join all items from the collection using a string. The final items can use a separate glue string.
598
     *
599
     * @param  string  $glue
600
     * @param  string  $finalGlue
601
     * @return string
602
     */
603
    public function join($glue, $finalGlue = '');
604
 
605
    /**
606
     * Get the keys of the collection items.
607
     *
608
     * @return static<int, TKey>
609
     */
610
    public function keys();
611
 
612
    /**
613
     * Get the last item from the collection.
614
     *
615
     * @template TLastDefault
616
     *
617
     * @param  (callable(TValue, TKey): bool)|null  $callback
618
     * @param  TLastDefault|(\Closure(): TLastDefault)  $default
619
     * @return TValue|TLastDefault
620
     */
621
    public function last(callable $callback = null, $default = null);
622
 
623
    /**
624
     * Run a map over each of the items.
625
     *
626
     * @template TMapValue
627
     *
628
     * @param  callable(TValue, TKey): TMapValue  $callback
629
     * @return static<TKey, TMapValue>
630
     */
631
    public function map(callable $callback);
632
 
633
    /**
634
     * Run a map over each nested chunk of items.
635
     *
636
     * @param  callable  $callback
637
     * @return static
638
     */
639
    public function mapSpread(callable $callback);
640
 
641
    /**
642
     * Run a dictionary map over the items.
643
     *
644
     * The callback should return an associative array with a single key/value pair.
645
     *
646
     * @template TMapToDictionaryKey of array-key
647
     * @template TMapToDictionaryValue
648
     *
649
     * @param  callable(TValue, TKey): array<TMapToDictionaryKey, TMapToDictionaryValue>  $callback
650
     * @return static<TMapToDictionaryKey, array<int, TMapToDictionaryValue>>
651
     */
652
    public function mapToDictionary(callable $callback);
653
 
654
    /**
655
     * Run a grouping map over the items.
656
     *
657
     * The callback should return an associative array with a single key/value pair.
658
     *
659
     * @template TMapToGroupsKey of array-key
660
     * @template TMapToGroupsValue
661
     *
662
     * @param  callable(TValue, TKey): array<TMapToGroupsKey, TMapToGroupsValue>  $callback
663
     * @return static<TMapToGroupsKey, static<int, TMapToGroupsValue>>
664
     */
665
    public function mapToGroups(callable $callback);
666
 
667
    /**
668
     * Run an associative map over each of the items.
669
     *
670
     * The callback should return an associative array with a single key/value pair.
671
     *
672
     * @template TMapWithKeysKey of array-key
673
     * @template TMapWithKeysValue
674
     *
675
     * @param  callable(TValue, TKey): array<TMapWithKeysKey, TMapWithKeysValue>  $callback
676
     * @return static<TMapWithKeysKey, TMapWithKeysValue>
677
     */
678
    public function mapWithKeys(callable $callback);
679
 
680
    /**
681
     * Map a collection and flatten the result by a single level.
682
     *
683
     * @template TFlatMapKey of array-key
684
     * @template TFlatMapValue
685
     *
686
     * @param  callable(TValue, TKey): (\Illuminate\Support\Collection<TFlatMapKey, TFlatMapValue>|array<TFlatMapKey, TFlatMapValue>)  $callback
687
     * @return static<TFlatMapKey, TFlatMapValue>
688
     */
689
    public function flatMap(callable $callback);
690
 
691
    /**
692
     * Map the values into a new class.
693
     *
694
     * @template TMapIntoValue
695
     *
696
     * @param  class-string<TMapIntoValue>  $class
697
     * @return static<TKey, TMapIntoValue>
698
     */
699
    public function mapInto($class);
700
 
701
    /**
702
     * Merge the collection with the given items.
703
     *
704
     * @param  \Illuminate\Contracts\Support\Arrayable<TKey, TValue>|iterable<TKey, TValue>  $items
705
     * @return static
706
     */
707
    public function merge($items);
708
 
709
    /**
710
     * Recursively merge the collection with the given items.
711
     *
712
     * @template TMergeRecursiveValue
713
     *
714
     * @param  \Illuminate\Contracts\Support\Arrayable<TKey, TMergeRecursiveValue>|iterable<TKey, TMergeRecursiveValue>  $items
715
     * @return static<TKey, TValue|TMergeRecursiveValue>
716
     */
717
    public function mergeRecursive($items);
718
 
719
    /**
720
     * Create a collection by using this collection for keys and another for its values.
721
     *
722
     * @template TCombineValue
723
     *
724
     * @param  \Illuminate\Contracts\Support\Arrayable<array-key, TCombineValue>|iterable<array-key, TCombineValue>  $values
725
     * @return static<TValue, TCombineValue>
726
     */
727
    public function combine($values);
728
 
729
    /**
730
     * Union the collection with the given items.
731
     *
732
     * @param  \Illuminate\Contracts\Support\Arrayable<TKey, TValue>|iterable<TKey, TValue>  $items
733
     * @return static
734
     */
735
    public function union($items);
736
 
737
    /**
738
     * Get the min value of a given key.
739
     *
740
     * @param  (callable(TValue):mixed)|string|null  $callback
741
     * @return mixed
742
     */
743
    public function min($callback = null);
744
 
745
    /**
746
     * Get the max value of a given key.
747
     *
748
     * @param  (callable(TValue):mixed)|string|null  $callback
749
     * @return mixed
750
     */
751
    public function max($callback = null);
752
 
753
    /**
754
     * Create a new collection consisting of every n-th element.
755
     *
756
     * @param  int  $step
757
     * @param  int  $offset
758
     * @return static
759
     */
760
    public function nth($step, $offset = 0);
761
 
762
    /**
763
     * Get the items with the specified keys.
764
     *
765
     * @param  \Illuminate\Support\Enumerable<array-key, TKey>|array<array-key, TKey>|string  $keys
766
     * @return static
767
     */
768
    public function only($keys);
769
 
770
    /**
771
     * "Paginate" the collection by slicing it into a smaller collection.
772
     *
773
     * @param  int  $page
774
     * @param  int  $perPage
775
     * @return static
776
     */
777
    public function forPage($page, $perPage);
778
 
779
    /**
780
     * Partition the collection into two arrays using the given callback or key.
781
     *
782
     * @param  (callable(TValue, TKey): bool)|TValue|string  $key
783
     * @param  mixed  $operator
784
     * @param  mixed  $value
785
     * @return static<int<0, 1>, static<TKey, TValue>>
786
     */
787
    public function partition($key, $operator = null, $value = null);
788
 
789
    /**
790
     * Push all of the given items onto the collection.
791
     *
792
     * @param  iterable<array-key, TValue>  $source
793
     * @return static
794
     */
795
    public function concat($source);
796
 
797
    /**
798
     * Get one or a specified number of items randomly from the collection.
799
     *
800
     * @param  int|null  $number
801
     * @return static<int, TValue>|TValue
802
     *
803
     * @throws \InvalidArgumentException
804
     */
805
    public function random($number = null);
806
 
807
    /**
808
     * Reduce the collection to a single value.
809
     *
810
     * @template TReduceInitial
811
     * @template TReduceReturnType
812
     *
813
     * @param  callable(TReduceInitial|TReduceReturnType, TValue, TKey): TReduceReturnType  $callback
814
     * @param  TReduceInitial  $initial
815
     * @return TReduceReturnType
816
     */
817
    public function reduce(callable $callback, $initial = null);
818
 
819
    /**
820
     * Reduce the collection to multiple aggregate values.
821
     *
822
     * @param  callable  $callback
823
     * @param  mixed  ...$initial
824
     * @return array
825
     *
826
     * @throws \UnexpectedValueException
827
     */
828
    public function reduceSpread(callable $callback, ...$initial);
829
 
830
    /**
831
     * Replace the collection items with the given items.
832
     *
833
     * @param  \Illuminate\Contracts\Support\Arrayable<TKey, TValue>|iterable<TKey, TValue>  $items
834
     * @return static
835
     */
836
    public function replace($items);
837
 
838
    /**
839
     * Recursively replace the collection items with the given items.
840
     *
841
     * @param  \Illuminate\Contracts\Support\Arrayable<TKey, TValue>|iterable<TKey, TValue>  $items
842
     * @return static
843
     */
844
    public function replaceRecursive($items);
845
 
846
    /**
847
     * Reverse items order.
848
     *
849
     * @return static
850
     */
851
    public function reverse();
852
 
853
    /**
854
     * Search the collection for a given value and return the corresponding key if successful.
855
     *
856
     * @param  TValue|callable(TValue,TKey): bool  $value
857
     * @param  bool  $strict
858
     * @return TKey|bool
859
     */
860
    public function search($value, $strict = false);
861
 
862
    /**
863
     * Shuffle the items in the collection.
864
     *
865
     * @param  int|null  $seed
866
     * @return static
867
     */
868
    public function shuffle($seed = null);
869
 
870
    /**
871
     * Create chunks representing a "sliding window" view of the items in the collection.
872
     *
873
     * @param  int  $size
874
     * @param  int  $step
875
     * @return static<int, static>
876
     */
877
    public function sliding($size = 2, $step = 1);
878
 
879
    /**
880
     * Skip the first {$count} items.
881
     *
882
     * @param  int  $count
883
     * @return static
884
     */
885
    public function skip($count);
886
 
887
    /**
888
     * Skip items in the collection until the given condition is met.
889
     *
890
     * @param  TValue|callable(TValue,TKey): bool  $value
891
     * @return static
892
     */
893
    public function skipUntil($value);
894
 
895
    /**
896
     * Skip items in the collection while the given condition is met.
897
     *
898
     * @param  TValue|callable(TValue,TKey): bool  $value
899
     * @return static
900
     */
901
    public function skipWhile($value);
902
 
903
    /**
904
     * Get a slice of items from the enumerable.
905
     *
906
     * @param  int  $offset
907
     * @param  int|null  $length
908
     * @return static
909
     */
910
    public function slice($offset, $length = null);
911
 
912
    /**
913
     * Split a collection into a certain number of groups.
914
     *
915
     * @param  int  $numberOfGroups
916
     * @return static<int, static>
917
     */
918
    public function split($numberOfGroups);
919
 
920
    /**
921
     * Get the first item in the collection, but only if exactly one item exists. Otherwise, throw an exception.
922
     *
923
     * @param  (callable(TValue, TKey): bool)|string  $key
924
     * @param  mixed  $operator
925
     * @param  mixed  $value
926
     * @return TValue
927
     *
928
     * @throws \Illuminate\Support\ItemNotFoundException
929
     * @throws \Illuminate\Support\MultipleItemsFoundException
930
     */
931
    public function sole($key = null, $operator = null, $value = null);
932
 
933
    /**
934
     * Get the first item in the collection but throw an exception if no matching items exist.
935
     *
936
     * @param  (callable(TValue, TKey): bool)|string  $key
937
     * @param  mixed  $operator
938
     * @param  mixed  $value
939
     * @return TValue
940
     *
941
     * @throws \Illuminate\Support\ItemNotFoundException
942
     */
943
    public function firstOrFail($key = null, $operator = null, $value = null);
944
 
945
    /**
946
     * Chunk the collection into chunks of the given size.
947
     *
948
     * @param  int  $size
949
     * @return static<int, static>
950
     */
951
    public function chunk($size);
952
 
953
    /**
954
     * Chunk the collection into chunks with a callback.
955
     *
956
     * @param  callable(TValue, TKey, static<int, TValue>): bool  $callback
957
     * @return static<int, static<int, TValue>>
958
     */
959
    public function chunkWhile(callable $callback);
960
 
961
    /**
962
     * Split a collection into a certain number of groups, and fill the first groups completely.
963
     *
964
     * @param  int  $numberOfGroups
965
     * @return static<int, static>
966
     */
967
    public function splitIn($numberOfGroups);
968
 
969
    /**
970
     * Sort through each item with a callback.
971
     *
972
     * @param  (callable(TValue, TValue): int)|null|int  $callback
973
     * @return static
974
     */
975
    public function sort($callback = null);
976
 
977
    /**
978
     * Sort items in descending order.
979
     *
980
     * @param  int  $options
981
     * @return static
982
     */
983
    public function sortDesc($options = SORT_REGULAR);
984
 
985
    /**
986
     * Sort the collection using the given callback.
987
     *
988
     * @param  array<array-key, (callable(TValue, TValue): mixed)|(callable(TValue, TKey): mixed)|string|array{string, string}>|(callable(TValue, TKey): mixed)|string  $callback
989
     * @param  int  $options
990
     * @param  bool  $descending
991
     * @return static
992
     */
993
    public function sortBy($callback, $options = SORT_REGULAR, $descending = false);
994
 
995
    /**
996
     * Sort the collection in descending order using the given callback.
997
     *
998
     * @param  array<array-key, (callable(TValue, TValue): mixed)|(callable(TValue, TKey): mixed)|string|array{string, string}>|(callable(TValue, TKey): mixed)|string  $callback
999
     * @param  int  $options
1000
     * @return static
1001
     */
1002
    public function sortByDesc($callback, $options = SORT_REGULAR);
1003
 
1004
    /**
1005
     * Sort the collection keys.
1006
     *
1007
     * @param  int  $options
1008
     * @param  bool  $descending
1009
     * @return static
1010
     */
1011
    public function sortKeys($options = SORT_REGULAR, $descending = false);
1012
 
1013
    /**
1014
     * Sort the collection keys in descending order.
1015
     *
1016
     * @param  int  $options
1017
     * @return static
1018
     */
1019
    public function sortKeysDesc($options = SORT_REGULAR);
1020
 
1021
    /**
1022
     * Sort the collection keys using a callback.
1023
     *
1024
     * @param  callable(TKey, TKey): int  $callback
1025
     * @return static
1026
     */
1027
    public function sortKeysUsing(callable $callback);
1028
 
1029
    /**
1030
     * Get the sum of the given values.
1031
     *
1032
     * @param  (callable(TValue): mixed)|string|null  $callback
1033
     * @return mixed
1034
     */
1035
    public function sum($callback = null);
1036
 
1037
    /**
1038
     * Take the first or last {$limit} items.
1039
     *
1040
     * @param  int  $limit
1041
     * @return static
1042
     */
1043
    public function take($limit);
1044
 
1045
    /**
1046
     * Take items in the collection until the given condition is met.
1047
     *
1048
     * @param  TValue|callable(TValue,TKey): bool  $value
1049
     * @return static
1050
     */
1051
    public function takeUntil($value);
1052
 
1053
    /**
1054
     * Take items in the collection while the given condition is met.
1055
     *
1056
     * @param  TValue|callable(TValue,TKey): bool  $value
1057
     * @return static
1058
     */
1059
    public function takeWhile($value);
1060
 
1061
    /**
1062
     * Pass the collection to the given callback and then return it.
1063
     *
1064
     * @param  callable(TValue): mixed  $callback
1065
     * @return $this
1066
     */
1067
    public function tap(callable $callback);
1068
 
1069
    /**
1070
     * Pass the enumerable to the given callback and return the result.
1071
     *
1072
     * @template TPipeReturnType
1073
     *
1074
     * @param  callable($this): TPipeReturnType  $callback
1075
     * @return TPipeReturnType
1076
     */
1077
    public function pipe(callable $callback);
1078
 
1079
    /**
1080
     * Pass the collection into a new class.
1081
     *
1082
     * @param  class-string  $class
1083
     * @return mixed
1084
     */
1085
    public function pipeInto($class);
1086
 
1087
    /**
1088
     * Pass the collection through a series of callable pipes and return the result.
1089
     *
1090
     * @param  array<callable>  $pipes
1091
     * @return mixed
1092
     */
1093
    public function pipeThrough($pipes);
1094
 
1095
    /**
1096
     * Get the values of a given key.
1097
     *
1098
     * @param  string|array<array-key, string>  $value
1099
     * @param  string|null  $key
1100
     * @return static<int, mixed>
1101
     */
1102
    public function pluck($value, $key = null);
1103
 
1104
    /**
1105
     * Create a collection of all elements that do not pass a given truth test.
1106
     *
1107
     * @param  (callable(TValue, TKey): bool)|bool|TValue  $callback
1108
     * @return static
1109
     */
1110
    public function reject($callback = true);
1111
 
1112
    /**
1113
     * Convert a flatten "dot" notation array into an expanded array.
1114
     *
1115
     * @return static
1116
     */
1117
    public function undot();
1118
 
1119
    /**
1120
     * Return only unique items from the collection array.
1121
     *
1122
     * @param  (callable(TValue, TKey): mixed)|string|null  $key
1123
     * @param  bool  $strict
1124
     * @return static
1125
     */
1126
    public function unique($key = null, $strict = false);
1127
 
1128
    /**
1129
     * Return only unique items from the collection array using strict comparison.
1130
     *
1131
     * @param  (callable(TValue, TKey): mixed)|string|null  $key
1132
     * @return static
1133
     */
1134
    public function uniqueStrict($key = null);
1135
 
1136
    /**
1137
     * Reset the keys on the underlying array.
1138
     *
1139
     * @return static<int, TValue>
1140
     */
1141
    public function values();
1142
 
1143
    /**
1144
     * Pad collection to the specified length with a value.
1145
     *
1146
     * @template TPadValue
1147
     *
1148
     * @param  int  $size
1149
     * @param  TPadValue  $value
1150
     * @return static<int, TValue|TPadValue>
1151
     */
1152
    public function pad($size, $value);
1153
 
1154
    /**
1155
     * Get the values iterator.
1156
     *
1157
     * @return \Traversable<TKey, TValue>
1158
     */
1159
    public function getIterator(): Traversable;
1160
 
1161
    /**
1162
     * Count the number of items in the collection.
1163
     *
1164
     * @return int
1165
     */
1166
    public function count(): int;
1167
 
1168
    /**
1169
     * Count the number of items in the collection by a field or using a callback.
1170
     *
1171
     * @param  (callable(TValue, TKey): mixed)|string|null  $countBy
1172
     * @return static<array-key, int>
1173
     */
1174
    public function countBy($countBy = null);
1175
 
1176
    /**
1177
     * Zip the collection together with one or more arrays.
1178
     *
1179
     * e.g. new Collection([1, 2, 3])->zip([4, 5, 6]);
1180
     *      => [[1, 4], [2, 5], [3, 6]]
1181
     *
1182
     * @template TZipValue
1183
     *
1184
     * @param  \Illuminate\Contracts\Support\Arrayable<array-key, TZipValue>|iterable<array-key, TZipValue>  ...$items
1185
     * @return static<int, static<int, TValue|TZipValue>>
1186
     */
1187
    public function zip($items);
1188
 
1189
    /**
1190
     * Collect the values into a collection.
1191
     *
1192
     * @return \Illuminate\Support\Collection<TKey, TValue>
1193
     */
1194
    public function collect();
1195
 
1196
    /**
1197
     * Get the collection of items as a plain array.
1198
     *
1199
     * @return array<TKey, mixed>
1200
     */
1201
    public function toArray();
1202
 
1203
    /**
1204
     * Convert the object into something JSON serializable.
1205
     *
1206
     * @return mixed
1207
     */
1208
    public function jsonSerialize(): mixed;
1209
 
1210
    /**
1211
     * Get the collection of items as JSON.
1212
     *
1213
     * @param  int  $options
1214
     * @return string
1215
     */
1216
    public function toJson($options = 0);
1217
 
1218
    /**
1219
     * Get a CachingIterator instance.
1220
     *
1221
     * @param  int  $flags
1222
     * @return \CachingIterator
1223
     */
1224
    public function getCachingIterator($flags = CachingIterator::CALL_TOSTRING);
1225
 
1226
    /**
1227
     * Convert the collection to its string representation.
1228
     *
1229
     * @return string
1230
     */
1231
    public function __toString();
1232
 
1233
    /**
1234
     * Indicate that the model's string representation should be escaped when __toString is invoked.
1235
     *
1236
     * @param  bool  $escape
1237
     * @return $this
1238
     */
1239
    public function escapeWhenCastingToString($escape = true);
1240
 
1241
    /**
1242
     * Add a method to the list of proxied methods.
1243
     *
1244
     * @param  string  $method
1245
     * @return void
1246
     */
1247
    public static function proxy($method);
1248
 
1249
    /**
1250
     * Dynamically access collection proxies.
1251
     *
1252
     * @param  string  $key
1253
     * @return mixed
1254
     *
1255
     * @throws \Exception
1256
     */
1257
    public function __get($key);
1258
}