| Total Complexity | 5 |
| Total Lines | 49 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 11 | class Buffer |
||
| 12 | { |
||
| 13 | /** |
||
| 14 | * @var string |
||
| 15 | */ |
||
| 16 | private $data = ''; |
||
| 17 | |||
| 18 | /** |
||
| 19 | * @param string $data |
||
| 20 | * @return int |
||
| 21 | */ |
||
| 22 | public function write(string $data) : int |
||
| 23 | { |
||
| 24 | return strlen($this->data .= $data); |
||
| 25 | } |
||
| 26 | |||
| 27 | /** |
||
| 28 | * @param int $len |
||
| 29 | * @return string |
||
| 30 | */ |
||
| 31 | public function read(int $len) : string |
||
| 36 | } |
||
| 37 | |||
| 38 | /** |
||
| 39 | * @return bool |
||
| 40 | */ |
||
| 41 | public function valid() : bool |
||
| 44 | } |
||
| 45 | |||
| 46 | /** |
||
| 47 | * @return int |
||
| 48 | */ |
||
| 49 | public function size() : int |
||
| 50 | { |
||
| 51 | return strlen($this->data); |
||
| 52 | } |
||
| 53 | |||
| 54 | /** |
||
| 55 | * @return bool |
||
| 56 | */ |
||
| 57 | public function eof() : bool |
||
| 60 | } |
||
| 61 | } |
||
| 62 |