| Total Complexity | 8 |
| Total Lines | 67 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 20 | final class BitBuffer{ |
||
| 21 | |||
| 22 | /** |
||
| 23 | * The buffer content |
||
| 24 | * |
||
| 25 | * @var int[] |
||
| 26 | */ |
||
| 27 | protected array $buffer = []; |
||
| 28 | |||
| 29 | /** |
||
| 30 | * Length of the content (bits) |
||
| 31 | */ |
||
| 32 | protected int $length = 0; |
||
| 33 | |||
| 34 | /** |
||
| 35 | * clears the buffer |
||
| 36 | */ |
||
| 37 | public function clear():BitBuffer{ |
||
| 38 | $this->buffer = []; |
||
| 39 | $this->length = 0; |
||
| 40 | |||
| 41 | return $this; |
||
| 42 | } |
||
| 43 | |||
| 44 | /** |
||
| 45 | * appends a sequence of bits |
||
| 46 | */ |
||
| 47 | public function put(int $num, int $length):BitBuffer{ |
||
| 54 | } |
||
| 55 | |||
| 56 | /** |
||
| 57 | * appends a single bit |
||
| 58 | */ |
||
| 59 | public function putBit(bool $bit):BitBuffer{ |
||
| 73 | } |
||
| 74 | |||
| 75 | /** |
||
| 76 | * returns the current buffer length |
||
| 77 | */ |
||
| 78 | public function getLength():int{ |
||
| 79 | return $this->length; |
||
| 80 | } |
||
| 81 | |||
| 82 | /** |
||
| 83 | * returns the buffer content |
||
| 84 | */ |
||
| 85 | public function getBuffer():array{ |
||
| 87 | } |
||
| 88 | |||
| 89 | } |
||
| 90 |