Passed
Push — master ( 904df5...62fce2 )
by Pol
02:08
created

CollectionDecorator   F

Complexity

Total Complexity 132

Size/Duplication

Total Lines 697
Duplicated Lines 0 %

Test Coverage

Coverage 97.34%

Importance

Changes 2
Bugs 0 Features 2
Metric Value
eloc 135
dl 0
loc 697
ccs 256
cts 263
cp 0.9734
rs 2
c 2
b 0
f 2
wmc 132

132 Methods

Rating   Name   Duplication   Size   Complexity  
A diffKeys() 0 3 1
A cache() 0 3 1
A current() 0 3 1
A empty() 0 3 1
A compare() 0 3 1
A coalesce() 0 3 1
A append() 0 3 1
A all() 0 3 1
A apply() 0 3 1
A drop() 0 3 1
A compact() 0 3 1
A __construct() 0 1 1
A combinate() 0 3 1
A distinct() 0 3 1
A dump() 0 3 1
A combine() 0 3 1
A chunk() 0 3 1
A diff() 0 3 1
A collapse() 0 3 1
A contains() 0 3 1
A averages() 0 3 1
A duplicate() 0 3 1
A dropWhile() 0 3 1
A cycle() 0 3 1
A column() 0 3 1
A countIn() 0 5 1
A associate() 0 5 1
A asyncMap() 0 3 1
A asyncMapN() 0 3 1
A wrap() 0 3 1
A scanRight1() 0 3 1
A tail() 0 3 1
A reject() 0 3 1
A unfold() 0 3 1
A strict() 0 3 1
A slice() 0 3 1
A takeWhile() 0 3 1
A split() 0 3 1
A unpair() 0 3 1
A until() 0 3 1
A unzip() 0 3 1
A shuffle() 0 3 1
A when() 0 3 1
A range() 0 3 1
A window() 0 3 1
A sort() 0 3 1
A truthy() 0 3 1
A reduction() 0 3 1
A squash() 0 3 1
A tails() 0 3 1
A times() 0 3 1
A unwindow() 0 3 1
A random() 0 3 1
A unpack() 0 3 1
A prepend() 0 3 1
A product() 0 3 1
A unwords() 0 3 1
A reduce() 0 3 1
A scanLeft1() 0 3 1
A span() 0 3 1
A words() 0 3 1
A since() 0 3 1
A scanLeft() 0 3 1
A unlines() 0 3 1
A unwrap() 0 3 1
A transpose() 0 3 1
A scanRight() 0 3 1
A rsample() 0 3 1
A scale() 0 8 1
A zip() 0 3 1
A reverse() 0 3 1
A same() 0 3 1
A equals() 0 3 1
A explode() 0 3 1
A fromFile() 0 3 1
A pipe() 0 3 1
A get() 0 3 1
A fromResource() 0 3 1
A every() 0 3 1
A group() 0 3 1
A intersectKeys() 0 3 1
A filter() 0 3 1
A intersect() 0 3 1
A keys() 0 3 1
A matching() 0 3 1
A map() 0 3 1
A init() 0 3 1
A intersperse() 0 3 1
A foldLeft() 0 3 1
A flip() 0 3 1
A permutate() 0 3 1
A foldLeft1() 0 3 1
A find() 0 3 1
A groupBy() 0 3 1
A ifThenElse() 0 3 1
A falsy() 0 3 1
A normalize() 0 3 1
A key() 0 3 1
A flatMap() 0 3 1
A limit() 0 3 1
A pack() 0 3 1
A min() 0 3 1
A pair() 0 3 1
A lines() 0 3 1
A flatten() 0 3 1
A head() 0 3 1
A fromString() 0 3 1
A fromCallable() 0 3 1
A match() 0 3 1
A has() 0 3 1
A frequency() 0 3 1
A pad() 0 3 1
A nth() 0 3 1
A inits() 0 3 1
A foldRight1() 0 3 1
A partition() 0 3 1
A last() 0 3 1
A fromIterable() 0 3 1
A isEmpty() 0 3 1
A first() 0 3 1
A merge() 0 3 1
A implode() 0 3 1
A foldRight() 0 3 1
A max() 0 3 1
A fromGenerator() 0 3 1
A pluck() 0 3 1
A getIterator() 0 3 1
A nullsy() 0 3 1
A mapN() 0 3 1
A forget() 0 3 1
A isNotEmpty() 0 3 1
A entropy() 0 3 1

How to fix   Complexity   

Complex Class

Complex classes like CollectionDecorator often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes.

Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.

While breaking up the class, it is a good idea to analyze how other classes use CollectionDecorator, and based on these observations, apply Extract Interface, too.

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