| Conditions | 6 |
| Paths | 4 |
| Total Lines | 24 |
| Code Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 15 |
| CRAP Score | 6 |
| Changes | 0 | ||
| 1 | <?php |
||
| 22 | 29 | private function newIterator(StreamInterface $stream): \Generator |
|
| 23 | { |
||
| 24 | 29 | $stream->rewind(); |
|
| 25 | |||
| 26 | 29 | $bytes = ''; |
|
| 27 | 29 | while (!$stream->eof()) { |
|
| 28 | 29 | $bytes .= $stream->read(1000); |
|
| 29 | |||
| 30 | 29 | $index = 0; |
|
| 31 | 29 | while (isset($bytes[$index])) { |
|
| 32 | 29 | if ($bytes[$index] === "\r" && isset($bytes[$index + 1]) && $bytes[$index + 1] === "\n") { |
|
| 33 | 10 | $line = \substr($bytes, 0, $index); |
|
| 34 | 10 | $bytes = \substr($bytes, $index + 2); |
|
| 35 | 10 | $index = -1; |
|
| 36 | |||
| 37 | 10 | yield $line; |
|
| 38 | } |
||
| 39 | |||
| 40 | 29 | $index++; |
|
| 41 | } |
||
| 42 | } |
||
| 43 | |||
| 44 | 27 | yield $bytes; |
|
| 45 | 20 | } |
|
| 46 | } |
||
| 47 |