Total Complexity | 11 |
Total Lines | 84 |
Duplicated Lines | 0 % |
Coverage | 50% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
8 | class Document extends Record implements \ArrayAccess |
||
9 | { |
||
10 | const TYPE = 6; |
||
11 | const LENGTH = 80; |
||
12 | |||
13 | /** |
||
14 | * @var array |
||
15 | */ |
||
16 | protected $lines = []; |
||
17 | |||
18 | /** |
||
19 | * @param Buffer $buffer |
||
20 | */ |
||
21 | 1 | public function read(Buffer $buffer) |
|
26 | } |
||
27 | 1 | } |
|
28 | |||
29 | /** |
||
30 | * @param Buffer $buffer |
||
31 | */ |
||
32 | 1 | public function write(Buffer $buffer) |
|
33 | { |
||
34 | 1 | $buffer->writeInt(self::TYPE); |
|
35 | 1 | $buffer->writeInt(count($this->lines)); |
|
36 | 1 | foreach ($this->lines as $line) { |
|
37 | 1 | $buffer->writeString((string) $line, self::LENGTH); |
|
38 | } |
||
39 | 1 | } |
|
40 | |||
41 | /** |
||
42 | * @return array |
||
43 | */ |
||
44 | 1 | public function toArray() |
|
45 | { |
||
46 | 1 | return $this->lines; |
|
47 | } |
||
48 | |||
49 | /** |
||
50 | * @param array $lines |
||
51 | */ |
||
52 | public function append($lines) |
||
56 | } |
||
57 | } |
||
58 | |||
59 | /** |
||
60 | * @param mixed $offset |
||
61 | * @return bool |
||
62 | */ |
||
63 | public function offsetExists($offset) |
||
64 | { |
||
65 | return isset($this->lines[$offset]); |
||
66 | } |
||
67 | |||
68 | /** |
||
69 | * @param mixed $offset |
||
70 | * @return mixed |
||
71 | */ |
||
72 | public function offsetGet($offset) |
||
73 | { |
||
74 | return $this->lines[$offset]; |
||
75 | } |
||
76 | |||
77 | /** |
||
78 | * @param mixed $offset |
||
79 | * @param mixed $value |
||
80 | */ |
||
81 | public function offsetSet($offset, $value) |
||
84 | } |
||
85 | |||
86 | /** |
||
87 | * @param mixed $offset |
||
88 | */ |
||
89 | public function offsetUnset($offset) |
||
92 | } |
||
93 | } |
||
94 |