1 | <?php |
||
17 | class Message |
||
18 | { |
||
19 | /** |
||
20 | * @var array |
||
21 | */ |
||
22 | private $frames; |
||
23 | |||
24 | /** |
||
25 | * @var bool |
||
26 | */ |
||
27 | private $isComplete; |
||
28 | |||
29 | /** |
||
30 | * @var string |
||
31 | */ |
||
32 | private $buffer; |
||
33 | |||
34 | 40 | public function __construct() |
|
40 | |||
41 | /** |
||
42 | * Add some data to the buffer. |
||
43 | * |
||
44 | * @param $data |
||
45 | */ |
||
46 | 13 | public function addBuffer($data) |
|
50 | |||
51 | /** |
||
52 | * Clear the buffer. |
||
53 | */ |
||
54 | 1 | public function clearBuffer() |
|
58 | |||
59 | /** |
||
60 | * Get data inside the buffer. |
||
61 | * |
||
62 | * @return string |
||
63 | */ |
||
64 | 13 | public function getBuffer() |
|
68 | |||
69 | /** |
||
70 | * Remove data from the start of the buffer. |
||
71 | * |
||
72 | * @param Frame $frame |
||
73 | * @return string |
||
74 | */ |
||
75 | 9 | public function removeFromBuffer(Frame $frame) : string |
|
81 | |||
82 | /** |
||
83 | * @param Frame $frame |
||
84 | * @return Message |
||
85 | * @throws \InvalidArgumentException |
||
86 | * @throws LimitationException |
||
87 | */ |
||
88 | 35 | public function addFrame(Frame $frame) : Message |
|
103 | |||
104 | /** |
||
105 | * @return Frame |
||
106 | * @throws MissingDataException |
||
107 | */ |
||
108 | 23 | public function getFirstFrame() : Frame |
|
116 | |||
117 | /** |
||
118 | * This could in the future be deprecated in favor of a stream object. |
||
119 | * |
||
120 | * @return string |
||
121 | * @throws MissingDataException |
||
122 | */ |
||
123 | 10 | public function getContent() : string |
|
137 | |||
138 | /** |
||
139 | * @return int |
||
140 | */ |
||
141 | 19 | public function getOpcode() |
|
145 | |||
146 | /** |
||
147 | * @return bool |
||
148 | */ |
||
149 | 10 | public function isComplete() |
|
153 | |||
154 | /** |
||
155 | * @return bool |
||
156 | */ |
||
157 | public function isOperation() |
||
161 | |||
162 | /** |
||
163 | * @return Frame[] |
||
164 | */ |
||
165 | 4 | public function getFrames() |
|
169 | |||
170 | /** |
||
171 | * @return bool |
||
172 | */ |
||
173 | 3 | public function hasFrames() |
|
177 | |||
178 | /** |
||
179 | * @return int |
||
180 | */ |
||
181 | public function countFrames() : int |
||
185 | } |
||
186 |