| @@ 70-80 (lines=11) @@ | ||
| 67 | * |
|
| 68 | * @return StreamInterface<self> |
|
| 69 | */ |
|
| 70 | public function chunk(int $size = 1): StreamInterface |
|
| 71 | { |
|
| 72 | $pieces = str_split($this->value, $size); |
|
| 73 | $stream = new Stream(self::class); |
|
| 74 | ||
| 75 | foreach ($pieces as $piece) { |
|
| 76 | $stream = $stream->add(new self($piece)); |
|
| 77 | } |
|
| 78 | ||
| 79 | return $stream; |
|
| 80 | } |
|
| 81 | ||
| 82 | /** |
|
| 83 | * Returns the position of the first occurence of the string |
|
| @@ 81-90 (lines=10) @@ | ||
| 78 | * |
|
| 79 | * @return TypedCollectionInterface |
|
| 80 | */ |
|
| 81 | public function chunk(int $size = 1): TypedCollectionInterface |
|
| 82 | { |
|
| 83 | $pieces = str_split($this->value, $size); |
|
| 84 | ||
| 85 | foreach ($pieces as &$piece) { |
|
| 86 | $piece = new self($piece); |
|
| 87 | } |
|
| 88 | ||
| 89 | return new TypedCollection(self::class, $pieces); |
|
| 90 | } |
|
| 91 | ||
| 92 | /** |
|
| 93 | * Returns the position of the first occurence of the string |
|