| Conditions | 6 |
| Paths | 4 |
| Total Lines | 25 |
| Code Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 15 |
| CRAP Score | 6 |
| Changes | 0 | ||
| 1 | <?php |
||
| 30 | 6 | public function execute(ConnectionInterface $connection): void |
|
| 31 | { |
||
| 32 | 6 | $bytes = ''; |
|
| 33 | |||
| 34 | 6 | while (!$this->stream->eof()) { |
|
| 35 | 6 | $bytes .= $this->stream->read(1000); |
|
| 36 | |||
| 37 | 6 | $index = 0; |
|
| 38 | 6 | while (isset($bytes[$index])) { |
|
| 39 | 6 | if ($bytes[$index] === "\r" && isset($bytes[$index+1]) && $bytes[$index+1] === "\n") { |
|
| 40 | 3 | $line = substr($bytes, 0, $index); |
|
| 41 | 3 | $bytes = substr($bytes, $index + 2); |
|
| 42 | 3 | $index = -1; |
|
| 43 | |||
| 44 | 3 | $this->sendLine($connection, $line); |
|
| 45 | } |
||
| 46 | |||
| 47 | 6 | $index++; |
|
| 48 | } |
||
| 49 | } |
||
| 50 | |||
| 51 | 6 | $this->sendLine($connection, $bytes); |
|
| 52 | |||
| 53 | 6 | $connection->send('.'); |
|
| 54 | 6 | } |
|
| 55 | |||
| 70 | } |