| Conditions | 4 |
| Paths | 4 |
| Total Lines | 18 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 54 | public function read(int $length): string |
||
| 55 | { |
||
| 56 | if ($this->isClosed()) { |
||
| 57 | throw new ConnectionException('Connection has been closed'); |
||
| 58 | } |
||
| 59 | |||
| 60 | if (0 === $length) { |
||
| 61 | return ''; |
||
| 62 | } |
||
| 63 | |||
| 64 | $buffer = @fread($this->socket, $length); |
||
| 65 | |||
| 66 | if (empty($buffer)) { |
||
| 67 | throw $this->createExceptionFromLastError('fread'); |
||
| 68 | } |
||
| 69 | |||
| 70 | return $buffer; |
||
| 71 | } |
||
| 72 | |||
| 108 |