1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
namespace loophp\collection; |
6
|
|
|
|
7
|
|
|
use Closure; |
8
|
|
|
use Doctrine\Common\Collections\Criteria; |
9
|
|
|
use Generator; |
10
|
|
|
use loophp\collection\Contract\Collection as CollectionInterface; |
11
|
|
|
use loophp\collection\Contract\Operation; |
12
|
|
|
use Psr\Cache\CacheItemPoolInterface; |
13
|
|
|
use Traversable; |
14
|
|
|
|
15
|
|
|
use const INF; |
16
|
|
|
use const PHP_INT_MAX; |
17
|
|
|
|
18
|
|
|
/** |
19
|
|
|
* @template TKey |
20
|
|
|
* @template T |
21
|
|
|
* |
22
|
|
|
* @immutable |
23
|
|
|
* |
24
|
|
|
* @psalm-consistent-constructor |
25
|
|
|
* |
26
|
|
|
* @psalm-consistent-templates |
27
|
|
|
* |
28
|
|
|
* @implements \loophp\collection\Contract\Collection<TKey, T> |
29
|
|
|
*/ |
30
|
|
|
abstract class CollectionDecorator implements CollectionInterface |
31
|
|
|
{ |
32
|
|
|
/** |
33
|
|
|
* @param CollectionInterface<TKey, T> $innerCollection |
34
|
|
|
*/ |
35
|
347 |
|
public function __construct(protected CollectionInterface $innerCollection) |
36
|
|
|
{ |
37
|
347 |
|
} |
38
|
|
|
|
39
|
5 |
|
public function all(bool $normalize = true): array |
40
|
|
|
{ |
41
|
5 |
|
return $this->innerCollection->all($normalize); |
42
|
|
|
} |
43
|
|
|
|
44
|
1 |
|
public function append(mixed ...$items): static |
45
|
|
|
{ |
46
|
1 |
|
return new static($this->innerCollection->append(...$items)); |
47
|
|
|
} |
48
|
|
|
|
49
|
2 |
|
public function apply(callable ...$callbacks): static |
50
|
|
|
{ |
51
|
2 |
|
return new static($this->innerCollection->apply(...$callbacks)); |
52
|
|
|
} |
53
|
|
|
|
54
|
2 |
|
public function associate( |
55
|
|
|
?callable $callbackForKeys = null, |
56
|
|
|
?callable $callbackForValues = null |
57
|
|
|
): static { |
58
|
2 |
|
return new static($this->innerCollection->associate($callbackForKeys, $callbackForValues)); |
59
|
|
|
} |
60
|
|
|
|
61
|
1 |
|
public function asyncMap(callable $callback): static |
62
|
|
|
{ |
63
|
1 |
|
return new static($this->innerCollection->asyncMap($callback)); |
64
|
|
|
} |
65
|
|
|
|
66
|
1 |
|
public function asyncMapN(callable ...$callbacks): static |
67
|
|
|
{ |
68
|
1 |
|
return new static($this->innerCollection->asyncMapN(...$callbacks)); |
69
|
|
|
} |
70
|
|
|
|
71
|
2 |
|
public function averages(): static |
72
|
|
|
{ |
73
|
2 |
|
return new static($this->innerCollection->averages()); |
74
|
|
|
} |
75
|
|
|
|
76
|
1 |
|
public function cache(?CacheItemPoolInterface $cache = null): static |
77
|
|
|
{ |
78
|
1 |
|
return new static($this->innerCollection->cache($cache)); |
79
|
|
|
} |
80
|
|
|
|
81
|
4 |
|
public function chunk(int ...$sizes): static |
82
|
|
|
{ |
83
|
4 |
|
return new static($this->innerCollection->chunk(...$sizes)); |
84
|
|
|
} |
85
|
|
|
|
86
|
2 |
|
public function coalesce(): static |
87
|
|
|
{ |
88
|
2 |
|
return new static($this->innerCollection->coalesce()); |
89
|
|
|
} |
90
|
|
|
|
91
|
2 |
|
public function collapse(): static |
92
|
|
|
{ |
93
|
2 |
|
return new static($this->innerCollection->collapse()); |
94
|
|
|
} |
95
|
|
|
|
96
|
3 |
|
public function column(mixed $column): static |
97
|
|
|
{ |
98
|
3 |
|
return new static($this->innerCollection->column($column)); |
99
|
|
|
} |
100
|
|
|
|
101
|
3 |
|
public function combinate(?int $length = null): static |
102
|
|
|
{ |
103
|
3 |
|
return new static($this->innerCollection->combinate($length)); |
104
|
|
|
} |
105
|
|
|
|
106
|
3 |
|
public function combine(mixed ...$keys): static |
107
|
|
|
{ |
108
|
3 |
|
return new static($this->innerCollection->combine(...$keys)); |
109
|
|
|
} |
110
|
|
|
|
111
|
2 |
|
public function compact(mixed ...$values): static |
112
|
|
|
{ |
113
|
2 |
|
return new static($this->innerCollection->compact(...$values)); |
114
|
|
|
} |
115
|
|
|
|
116
|
5 |
|
public function compare(callable $comparator, $default = null): mixed |
117
|
|
|
{ |
118
|
5 |
|
return $this->innerCollection->compare($comparator, $default); |
119
|
|
|
} |
120
|
|
|
|
121
|
5 |
|
public function contains(mixed ...$values): bool |
122
|
|
|
{ |
123
|
5 |
|
return $this->innerCollection->contains(...$values); |
124
|
|
|
} |
125
|
|
|
|
126
|
|
|
public function countIn(int &$counter): CollectionInterface |
127
|
|
|
{ |
128
|
|
|
$this->innerCollection->countIn($counter); |
129
|
|
|
|
130
|
|
|
return $this; |
131
|
|
|
} |
132
|
|
|
|
133
|
3 |
|
public function current(int $index = 0, $default = null): mixed |
134
|
|
|
{ |
135
|
3 |
|
return $this->innerCollection->current($index, $default); |
136
|
|
|
} |
137
|
|
|
|
138
|
1 |
|
public function cycle(): static |
139
|
|
|
{ |
140
|
1 |
|
return new static($this->innerCollection->cycle()); |
141
|
|
|
} |
142
|
|
|
|
143
|
7 |
|
public function diff(mixed ...$values): static |
144
|
|
|
{ |
145
|
7 |
|
return new static($this->innerCollection->diff(...$values)); |
146
|
|
|
} |
147
|
|
|
|
148
|
2 |
|
public function diffKeys(mixed ...$keys): static |
149
|
|
|
{ |
150
|
2 |
|
return new static($this->innerCollection->diffKeys(...$keys)); |
151
|
|
|
} |
152
|
|
|
|
153
|
6 |
|
public function distinct(?callable $comparatorCallback = null, ?callable $accessorCallback = null): static |
154
|
|
|
{ |
155
|
6 |
|
return new static($this->innerCollection->distinct($comparatorCallback, $accessorCallback)); |
156
|
|
|
} |
157
|
|
|
|
158
|
2 |
|
public function drop(int $count): static |
159
|
|
|
{ |
160
|
2 |
|
return new static($this->innerCollection->drop($count)); |
161
|
|
|
} |
162
|
|
|
|
163
|
2 |
|
public function dropWhile(callable ...$callbacks): static |
164
|
|
|
{ |
165
|
2 |
|
return new static($this->innerCollection->dropWhile(...$callbacks)); |
166
|
|
|
} |
167
|
|
|
|
168
|
2 |
|
public function dump(string $name = '', int $size = 1, ?Closure $closure = null): static |
169
|
|
|
{ |
170
|
2 |
|
return new static($this->innerCollection->dump($name, $size, $closure)); |
171
|
|
|
} |
172
|
|
|
|
173
|
5 |
|
public function duplicate(?callable $comparatorCallback = null, ?callable $accessorCallback = null): static |
174
|
|
|
{ |
175
|
5 |
|
return new static($this->innerCollection->duplicate($comparatorCallback, $accessorCallback)); |
176
|
|
|
} |
177
|
|
|
|
178
|
1 |
|
public static function empty(): static |
179
|
|
|
{ |
180
|
1 |
|
return new static(Collection::empty()); |
181
|
|
|
} |
182
|
|
|
|
183
|
18 |
|
public function equals(iterable $other): bool |
184
|
|
|
{ |
185
|
18 |
|
return $this->innerCollection->equals($other); |
186
|
|
|
} |
187
|
|
|
|
188
|
8 |
|
public function every(callable ...$callbacks): bool |
189
|
|
|
{ |
190
|
8 |
|
return $this->innerCollection->every(...$callbacks); |
191
|
|
|
} |
192
|
|
|
|
193
|
1 |
|
public function explode(mixed ...$explodes): static |
194
|
|
|
{ |
195
|
1 |
|
return new static($this->innerCollection->explode(...$explodes)); |
196
|
|
|
} |
197
|
|
|
|
198
|
4 |
|
public function falsy(): bool |
199
|
|
|
{ |
200
|
4 |
|
return $this->innerCollection->falsy(); |
201
|
|
|
} |
202
|
|
|
|
203
|
4 |
|
public function filter(callable ...$callbacks): static |
204
|
|
|
{ |
205
|
4 |
|
return new static($this->innerCollection->filter(...$callbacks)); |
206
|
|
|
} |
207
|
|
|
|
208
|
5 |
|
public function find($default = null, callable ...$callbacks): mixed |
209
|
|
|
{ |
210
|
5 |
|
return $this->innerCollection->find($default, ...$callbacks); |
211
|
|
|
} |
212
|
|
|
|
213
|
5 |
|
public function first($default = null): mixed |
214
|
|
|
{ |
215
|
5 |
|
return $this->innerCollection->first($default); |
216
|
|
|
} |
217
|
|
|
|
218
|
7 |
|
public function flatMap(callable $callback): static |
219
|
|
|
{ |
220
|
7 |
|
return new static($this->innerCollection->flatMap($callback)); |
221
|
|
|
} |
222
|
|
|
|
223
|
3 |
|
public function flatten(int $depth = PHP_INT_MAX): static |
224
|
|
|
{ |
225
|
3 |
|
return new static($this->innerCollection->flatten($depth)); |
226
|
|
|
} |
227
|
|
|
|
228
|
2 |
|
public function flip(): static |
229
|
|
|
{ |
230
|
2 |
|
return new static($this->innerCollection->flip()); |
231
|
|
|
} |
232
|
|
|
|
233
|
4 |
|
public function foldLeft(callable $callback, $initial): mixed |
234
|
|
|
{ |
235
|
4 |
|
return $this->innerCollection->foldLeft($callback, $initial); |
236
|
|
|
} |
237
|
|
|
|
238
|
2 |
|
public function foldLeft1(callable $callback): mixed |
239
|
|
|
{ |
240
|
2 |
|
return $this->innerCollection->foldLeft1($callback); |
241
|
|
|
} |
242
|
|
|
|
243
|
1 |
|
public function foldRight(callable $callback, $initial): mixed |
244
|
|
|
{ |
245
|
1 |
|
return $this->innerCollection->foldRight($callback, $initial); |
246
|
|
|
} |
247
|
|
|
|
248
|
2 |
|
public function foldRight1(callable $callback): mixed |
249
|
|
|
{ |
250
|
2 |
|
return $this->innerCollection->foldRight1($callback); |
251
|
|
|
} |
252
|
|
|
|
253
|
1 |
|
public function forget(mixed ...$keys): static |
254
|
|
|
{ |
255
|
1 |
|
return new static($this->innerCollection->forget(...$keys)); |
256
|
|
|
} |
257
|
|
|
|
258
|
1 |
|
public function frequency(): static |
259
|
|
|
{ |
260
|
1 |
|
return new static($this->innerCollection->frequency()); |
261
|
|
|
} |
262
|
|
|
|
263
|
|
|
/** |
264
|
|
|
* @template UKey |
265
|
|
|
* @template U |
266
|
|
|
* |
267
|
|
|
* @param callable(mixed ...$parameters): iterable<UKey, U> $callable |
268
|
|
|
* @param iterable<int, mixed> $parameters |
269
|
|
|
* |
270
|
|
|
* @return static<UKey, U> |
271
|
|
|
*/ |
272
|
1 |
|
public static function fromCallable(callable $callable, iterable $parameters = []): static |
273
|
|
|
{ |
274
|
1 |
|
return new static(Collection::fromCallable($callable, $parameters)); |
275
|
|
|
} |
276
|
|
|
|
277
|
|
|
/** |
278
|
|
|
* @param null|non-negative-int $length |
|
|
|
|
279
|
|
|
*/ |
280
|
1 |
|
public static function fromFile(string $filepath, ?int $length = 2): static |
281
|
|
|
{ |
282
|
1 |
|
return new static(Collection::fromFile($filepath, $length)); |
283
|
|
|
} |
284
|
|
|
|
285
|
1 |
|
public static function fromGenerator(Generator $generator): static |
286
|
|
|
{ |
287
|
1 |
|
return new static(Collection::fromGenerator($generator)); |
288
|
|
|
} |
289
|
|
|
|
290
|
|
|
/** |
291
|
|
|
* @template UKey |
292
|
|
|
* @template U |
293
|
|
|
* |
294
|
|
|
* @param iterable<UKey, U> $iterable |
295
|
|
|
* |
296
|
|
|
* @return static<UKey, U> |
297
|
|
|
*/ |
298
|
1 |
|
public static function fromIterable(iterable $iterable): static |
299
|
|
|
{ |
300
|
1 |
|
return new static(Collection::fromIterable($iterable)); |
301
|
|
|
} |
302
|
|
|
|
303
|
|
|
/** |
304
|
|
|
* @param resource $resource |
305
|
|
|
* |
306
|
|
|
* @return static<int, string> |
307
|
|
|
*/ |
308
|
1 |
|
public static function fromResource($resource): static |
309
|
|
|
{ |
310
|
1 |
|
return new static(Collection::fromResource($resource)); |
311
|
|
|
} |
312
|
|
|
|
313
|
1 |
|
public static function fromString(string $string, string $delimiter = ''): static |
314
|
|
|
{ |
315
|
1 |
|
return new static(Collection::fromString($string, $delimiter)); |
316
|
|
|
} |
317
|
|
|
|
318
|
2 |
|
public function get(mixed $key, $default = null): mixed |
319
|
|
|
{ |
320
|
2 |
|
return $this->innerCollection->get($key, $default); |
321
|
|
|
} |
322
|
|
|
|
323
|
|
|
/** |
324
|
|
|
* @return Traversable<TKey, T> |
325
|
|
|
*/ |
326
|
200 |
|
public function getIterator(): Traversable |
327
|
|
|
{ |
328
|
200 |
|
yield from $this->innerCollection->getIterator(); |
329
|
|
|
} |
330
|
|
|
|
331
|
3 |
|
public function group(): static |
332
|
|
|
{ |
333
|
3 |
|
return new static($this->innerCollection->group()); |
334
|
|
|
} |
335
|
|
|
|
336
|
2 |
|
public function groupBy(callable $callback): static |
337
|
|
|
{ |
338
|
2 |
|
return new static($this->innerCollection->groupBy($callback)); |
339
|
|
|
} |
340
|
|
|
|
341
|
8 |
|
public function has(callable ...$callbacks): bool |
342
|
|
|
{ |
343
|
8 |
|
return $this->innerCollection->has(...$callbacks); |
344
|
|
|
} |
345
|
|
|
|
346
|
3 |
|
public function head($default = null): mixed |
347
|
|
|
{ |
348
|
3 |
|
return $this->innerCollection->head($default); |
349
|
|
|
} |
350
|
|
|
|
351
|
2 |
|
public function ifThenElse(callable $condition, callable $then, ?callable $else = null): static |
352
|
|
|
{ |
353
|
2 |
|
return new static($this->innerCollection->ifThenElse($condition, $then, $else)); |
354
|
|
|
} |
355
|
|
|
|
356
|
3 |
|
public function implode(string $glue = ''): string |
357
|
|
|
{ |
358
|
3 |
|
return $this->innerCollection->implode($glue); |
359
|
|
|
} |
360
|
|
|
|
361
|
2 |
|
public function init(): static |
362
|
|
|
{ |
363
|
2 |
|
return new static($this->innerCollection->init()); |
364
|
|
|
} |
365
|
|
|
|
366
|
2 |
|
public function inits(): static |
367
|
|
|
{ |
368
|
2 |
|
return new static($this->innerCollection->inits()); |
369
|
|
|
} |
370
|
|
|
|
371
|
2 |
|
public function intersect(mixed ...$values): static |
372
|
|
|
{ |
373
|
2 |
|
return new static($this->innerCollection->intersect(...$values)); |
374
|
|
|
} |
375
|
|
|
|
376
|
3 |
|
public function intersectKeys(mixed ...$keys): static |
377
|
|
|
{ |
378
|
3 |
|
return new static($this->innerCollection->intersectKeys(...$keys)); |
379
|
|
|
} |
380
|
|
|
|
381
|
5 |
|
public function intersperse(mixed $element, int $every = 1, int $startAt = 0): static |
382
|
|
|
{ |
383
|
5 |
|
return new static($this->innerCollection->intersperse($element, $every, $startAt)); |
384
|
|
|
} |
385
|
|
|
|
386
|
7 |
|
public function isEmpty(): bool |
387
|
|
|
{ |
388
|
7 |
|
return $this->innerCollection->isEmpty(); |
389
|
|
|
} |
390
|
|
|
|
391
|
7 |
|
public function isNotEmpty(): bool |
392
|
|
|
{ |
393
|
7 |
|
return $this->innerCollection->isNotEmpty(); |
394
|
|
|
} |
395
|
|
|
|
396
|
3 |
|
public function key(int $index = 0): mixed |
397
|
|
|
{ |
398
|
3 |
|
return $this->innerCollection->key($index); |
399
|
|
|
} |
400
|
|
|
|
401
|
1 |
|
public function keys(): static |
402
|
|
|
{ |
403
|
1 |
|
return new static($this->innerCollection->keys()); |
404
|
|
|
} |
405
|
|
|
|
406
|
7 |
|
public function last($default = null): mixed |
407
|
|
|
{ |
408
|
7 |
|
return $this->innerCollection->last($default); |
409
|
|
|
} |
410
|
|
|
|
411
|
5 |
|
public function limit(int $count = -1, int $offset = 0): static |
412
|
|
|
{ |
413
|
5 |
|
return new static($this->innerCollection->limit($count, $offset)); |
414
|
|
|
} |
415
|
|
|
|
416
|
1 |
|
public function lines(): static |
417
|
|
|
{ |
418
|
1 |
|
return new static($this->innerCollection->lines()); |
419
|
|
|
} |
420
|
|
|
|
421
|
2 |
|
public function map(callable $callback): static |
422
|
|
|
{ |
423
|
2 |
|
return new static($this->innerCollection->map($callback)); |
424
|
|
|
} |
425
|
|
|
|
426
|
2 |
|
public function mapN(callable ...$callbacks): static |
427
|
|
|
{ |
428
|
2 |
|
return new static($this->innerCollection->mapN(...$callbacks)); |
429
|
|
|
} |
430
|
|
|
|
431
|
3 |
|
public function match(callable $callback, ?callable $matcher = null): bool |
432
|
|
|
{ |
433
|
3 |
|
return $this->innerCollection->match($callback, $matcher); |
434
|
|
|
} |
435
|
|
|
|
436
|
1 |
|
public function matching(Criteria $criteria): static |
437
|
|
|
{ |
438
|
1 |
|
return new static($this->innerCollection->matching($criteria)); |
439
|
|
|
} |
440
|
|
|
|
441
|
4 |
|
public function max($default = null): mixed |
442
|
|
|
{ |
443
|
4 |
|
return $this->innerCollection->max($default); |
444
|
|
|
} |
445
|
|
|
|
446
|
1 |
|
public function merge(iterable ...$sources): static |
447
|
|
|
{ |
448
|
1 |
|
return new static($this->innerCollection->merge(...$sources)); |
449
|
|
|
} |
450
|
|
|
|
451
|
4 |
|
public function min($default = null): mixed |
452
|
|
|
{ |
453
|
4 |
|
return $this->innerCollection->min($default); |
454
|
|
|
} |
455
|
|
|
|
456
|
3 |
|
public function normalize(): static |
457
|
|
|
{ |
458
|
3 |
|
return new static($this->innerCollection->normalize()); |
459
|
|
|
} |
460
|
|
|
|
461
|
2 |
|
public function nth(int $step, int $offset = 0): static |
462
|
|
|
{ |
463
|
2 |
|
return new static($this->innerCollection->nth($step, $offset)); |
464
|
|
|
} |
465
|
|
|
|
466
|
4 |
|
public function nullsy(): bool |
467
|
|
|
{ |
468
|
4 |
|
return $this->innerCollection->nullsy(); |
469
|
|
|
} |
470
|
|
|
|
471
|
1 |
|
public function pack(): static |
472
|
|
|
{ |
473
|
1 |
|
return new static($this->innerCollection->pack()); |
474
|
|
|
} |
475
|
|
|
|
476
|
1 |
|
public function pad(int $size, mixed $value): static |
477
|
|
|
{ |
478
|
1 |
|
return new static($this->innerCollection->pad($size, $value)); |
479
|
|
|
} |
480
|
|
|
|
481
|
2 |
|
public function pair(): static |
482
|
|
|
{ |
483
|
2 |
|
return new static($this->innerCollection->pair()); |
484
|
|
|
} |
485
|
|
|
|
486
|
1 |
|
public function partition(callable ...$callbacks): static |
487
|
|
|
{ |
488
|
1 |
|
return new static($this->innerCollection->partition(...$callbacks)); |
489
|
|
|
} |
490
|
|
|
|
491
|
1 |
|
public function permutate(): static |
492
|
|
|
{ |
493
|
1 |
|
return new static($this->innerCollection->permutate()); |
494
|
|
|
} |
495
|
|
|
|
496
|
1 |
|
public function pipe(callable ...$callbacks): static |
497
|
|
|
{ |
498
|
1 |
|
return new static($this->innerCollection->pipe(...$callbacks)); |
499
|
|
|
} |
500
|
|
|
|
501
|
6 |
|
public function pluck(mixed $pluck, mixed $default = null): static |
502
|
|
|
{ |
503
|
6 |
|
return new static($this->innerCollection->pluck($pluck, $default)); |
504
|
|
|
} |
505
|
|
|
|
506
|
1 |
|
public function prepend(mixed ...$items): static |
507
|
|
|
{ |
508
|
1 |
|
return new static($this->innerCollection->prepend(...$items)); |
509
|
|
|
} |
510
|
|
|
|
511
|
2 |
|
public function product(iterable ...$iterables): static |
512
|
|
|
{ |
513
|
2 |
|
return new static($this->innerCollection->product(...$iterables)); |
514
|
|
|
} |
515
|
|
|
|
516
|
1 |
|
public function random(int $size = 1, ?int $seed = null): static |
517
|
|
|
{ |
518
|
1 |
|
return new static($this->innerCollection->random($size, $seed)); |
519
|
|
|
} |
520
|
|
|
|
521
|
1 |
|
public static function range(float $start = 0.0, float $end = INF, float $step = 1.0): CollectionInterface |
522
|
|
|
{ |
523
|
1 |
|
return new static(Collection::range($start, $end, $step)); |
524
|
|
|
} |
525
|
|
|
|
526
|
3 |
|
public function reduce(callable $callback, mixed $initial = null): mixed |
527
|
|
|
{ |
528
|
3 |
|
return $this->innerCollection->reduce($callback, $initial); |
529
|
|
|
} |
530
|
|
|
|
531
|
1 |
|
public function reduction(callable $callback, mixed $initial = null): static |
532
|
|
|
{ |
533
|
1 |
|
return new static($this->innerCollection->reduction($callback, $initial)); |
534
|
|
|
} |
535
|
|
|
|
536
|
4 |
|
public function reject(callable ...$callbacks): static |
537
|
|
|
{ |
538
|
4 |
|
return new static($this->innerCollection->reject(...$callbacks)); |
539
|
|
|
} |
540
|
|
|
|
541
|
2 |
|
public function reverse(): static |
542
|
|
|
{ |
543
|
2 |
|
return new static($this->innerCollection->reverse()); |
544
|
|
|
} |
545
|
|
|
|
546
|
|
|
public function rsample(float $probability): static |
547
|
|
|
{ |
548
|
|
|
return new static($this->innerCollection->rsample($probability)); |
549
|
|
|
} |
550
|
|
|
|
551
|
23 |
|
public function same(iterable $other, ?callable $comparatorCallback = null): bool |
552
|
|
|
{ |
553
|
23 |
|
return $this->innerCollection->same($other, $comparatorCallback); |
554
|
|
|
} |
555
|
|
|
|
556
|
1 |
|
public function scale( |
557
|
|
|
float $lowerBound, |
558
|
|
|
float $upperBound, |
559
|
|
|
float $wantedLowerBound = 0.0, |
560
|
|
|
float $wantedUpperBound = 1.0, |
561
|
|
|
float $base = 0.0 |
562
|
|
|
): static { |
563
|
1 |
|
return new static($this->innerCollection->scale($lowerBound, $upperBound, $wantedLowerBound, $wantedUpperBound)); |
564
|
|
|
} |
565
|
|
|
|
566
|
2 |
|
public function scanLeft(callable $callback, mixed $initial): static |
567
|
|
|
{ |
568
|
2 |
|
return new static($this->innerCollection->scanLeft($callback, $initial)); |
569
|
|
|
} |
570
|
|
|
|
571
|
3 |
|
public function scanLeft1(callable $callback): static |
572
|
|
|
{ |
573
|
3 |
|
return new static($this->innerCollection->scanLeft1($callback)); |
574
|
|
|
} |
575
|
|
|
|
576
|
2 |
|
public function scanRight(callable $callback, mixed $initial): static |
577
|
|
|
{ |
578
|
2 |
|
return new static($this->innerCollection->scanRight($callback, $initial)); |
579
|
|
|
} |
580
|
|
|
|
581
|
2 |
|
public function scanRight1(callable $callback): static |
582
|
|
|
{ |
583
|
2 |
|
return new static($this->innerCollection->scanRight1($callback)); |
584
|
|
|
} |
585
|
|
|
|
586
|
1 |
|
public function shuffle(?int $seed = null): static |
587
|
|
|
{ |
588
|
1 |
|
return new static($this->innerCollection->shuffle($seed)); |
589
|
|
|
} |
590
|
|
|
|
591
|
4 |
|
public function since(callable ...$callbacks): static |
592
|
|
|
{ |
593
|
4 |
|
return new static($this->innerCollection->since(...$callbacks)); |
594
|
|
|
} |
595
|
|
|
|
596
|
3 |
|
public function slice(int $offset, int $length = -1): static |
597
|
|
|
{ |
598
|
3 |
|
return new static($this->innerCollection->slice($offset, $length)); |
599
|
|
|
} |
600
|
|
|
|
601
|
5 |
|
public function sort(int $type = Operation\Sortable::BY_VALUES, ?callable $callback = null): static |
602
|
|
|
{ |
603
|
5 |
|
return new static($this->innerCollection->sort($type, $callback)); |
604
|
|
|
} |
605
|
|
|
|
606
|
1 |
|
public function span(callable ...$callbacks): static |
607
|
|
|
{ |
608
|
1 |
|
return new static($this->innerCollection->span(...$callbacks)); |
609
|
|
|
} |
610
|
|
|
|
611
|
3 |
|
public function split(int $type = Operation\Splitable::BEFORE, callable ...$callbacks): static |
612
|
|
|
{ |
613
|
3 |
|
return new static($this->innerCollection->split($type, ...$callbacks)); |
614
|
|
|
} |
615
|
|
|
|
616
|
1 |
|
public function squash(): static |
617
|
|
|
{ |
618
|
1 |
|
return new static($this->innerCollection->squash()); |
619
|
|
|
} |
620
|
|
|
|
621
|
1 |
|
public function strict(?callable $callback = null): static |
622
|
|
|
{ |
623
|
1 |
|
return new static($this->innerCollection->strict($callback)); |
624
|
|
|
} |
625
|
|
|
|
626
|
1 |
|
public function tail(): static |
627
|
|
|
{ |
628
|
1 |
|
return new static($this->innerCollection->tail()); |
629
|
|
|
} |
630
|
|
|
|
631
|
2 |
|
public function tails(): static |
632
|
|
|
{ |
633
|
2 |
|
return new static($this->innerCollection->tails()); |
634
|
|
|
} |
635
|
|
|
|
636
|
3 |
|
public function takeWhile(callable ...$callbacks): static |
637
|
|
|
{ |
638
|
3 |
|
return new static($this->innerCollection->takeWhile(...$callbacks)); |
639
|
|
|
} |
640
|
|
|
|
641
|
1 |
|
public static function times(int $number = 0, ?callable $callback = null): static |
642
|
|
|
{ |
643
|
1 |
|
return new static(Collection::times($number, $callback)); |
644
|
|
|
} |
645
|
|
|
|
646
|
1 |
|
public function transpose(): static |
647
|
|
|
{ |
648
|
1 |
|
return new static($this->innerCollection->transpose()); |
649
|
|
|
} |
650
|
|
|
|
651
|
4 |
|
public function truthy(): bool |
652
|
|
|
{ |
653
|
4 |
|
return $this->innerCollection->truthy(); |
654
|
|
|
} |
655
|
|
|
|
656
|
1 |
|
public static function unfold(callable $callback, iterable $parameters = []): static |
657
|
|
|
{ |
658
|
1 |
|
return new static(Collection::unfold($callback, $parameters)); |
659
|
|
|
} |
660
|
|
|
|
661
|
1 |
|
public function unlines(): string |
662
|
|
|
{ |
663
|
1 |
|
return $this->innerCollection->unlines(); |
664
|
|
|
} |
665
|
|
|
|
666
|
1 |
|
public function unpack(): static |
667
|
|
|
{ |
668
|
1 |
|
return new static($this->innerCollection->unpack()); |
669
|
|
|
} |
670
|
|
|
|
671
|
1 |
|
public function unpair(): static |
672
|
|
|
{ |
673
|
1 |
|
return new static($this->innerCollection->unpair()); |
674
|
|
|
} |
675
|
|
|
|
676
|
2 |
|
public function until(callable ...$callbacks): static |
677
|
|
|
{ |
678
|
2 |
|
return new static($this->innerCollection->until(...$callbacks)); |
679
|
|
|
} |
680
|
|
|
|
681
|
1 |
|
public function unwindow(): static |
682
|
|
|
{ |
683
|
1 |
|
return new static($this->innerCollection->unwindow()); |
684
|
|
|
} |
685
|
|
|
|
686
|
1 |
|
public function unwords(): string |
687
|
|
|
{ |
688
|
1 |
|
return $this->innerCollection->unwords(); |
689
|
|
|
} |
690
|
|
|
|
691
|
3 |
|
public function unwrap(): static |
692
|
|
|
{ |
693
|
3 |
|
return new static($this->innerCollection->unwrap()); |
694
|
|
|
} |
695
|
|
|
|
696
|
1 |
|
public function unzip(): static |
697
|
|
|
{ |
698
|
1 |
|
return new static($this->innerCollection->unzip()); |
699
|
|
|
} |
700
|
|
|
|
701
|
2 |
|
public function when(callable $predicate, callable $whenTrue, ?callable $whenFalse = null): static |
702
|
|
|
{ |
703
|
2 |
|
return new static($this->innerCollection->when($predicate, $whenTrue, $whenFalse)); |
704
|
|
|
} |
705
|
|
|
|
706
|
4 |
|
public function window(int $size): static |
707
|
|
|
{ |
708
|
4 |
|
return new static($this->innerCollection->window($size)); |
709
|
|
|
} |
710
|
|
|
|
711
|
1 |
|
public function words(): static |
712
|
|
|
{ |
713
|
1 |
|
return new static($this->innerCollection->words()); |
714
|
|
|
} |
715
|
|
|
|
716
|
2 |
|
public function wrap(): static |
717
|
|
|
{ |
718
|
2 |
|
return new static($this->innerCollection->wrap()); |
719
|
|
|
} |
720
|
|
|
|
721
|
2 |
|
public function zip(iterable ...$iterables): static |
722
|
|
|
{ |
723
|
2 |
|
return new static($this->innerCollection->zip(...$iterables)); |
724
|
|
|
} |
725
|
|
|
} |
726
|
|
|
|