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 | 13 | public function addBuffer($data) |
|
45 | |||
46 | 1 | public function clearBuffer() |
|
47 | { |
||
48 | 1 | $this->buffer = ''; |
|
49 | 1 | } |
|
50 | |||
51 | 13 | public function getBuffer() |
|
55 | |||
56 | 9 | public function removeFromBuffer(Frame $frame) : string |
|
62 | |||
63 | /** |
||
64 | * @param Frame $frame |
||
65 | * @return Message |
||
66 | * @throws \InvalidArgumentException |
||
67 | * @throws LimitationException |
||
68 | */ |
||
69 | 35 | public function addFrame(Frame $frame) : Message |
|
84 | |||
85 | /** |
||
86 | * @return Frame |
||
87 | * @throws MissingDataException |
||
88 | */ |
||
89 | 23 | public function getFirstFrame() : Frame |
|
97 | |||
98 | /** |
||
99 | * This could in the future be deprecated in favor of a stream object. |
||
100 | * |
||
101 | * @return string |
||
102 | * @throws MissingDataException |
||
103 | */ |
||
104 | 10 | public function getContent() : string |
|
118 | |||
119 | /** |
||
120 | * @return int |
||
121 | */ |
||
122 | 19 | public function getOpcode() |
|
126 | |||
127 | /** |
||
128 | * @return bool |
||
129 | */ |
||
130 | 10 | public function isComplete() |
|
134 | |||
135 | /** |
||
136 | * @return bool |
||
137 | */ |
||
138 | public function isOperation() |
||
142 | |||
143 | /** |
||
144 | * @return Frame[] |
||
145 | */ |
||
146 | 4 | public function getFrames() |
|
150 | |||
151 | /** |
||
152 | * @return int |
||
153 | */ |
||
154 | 3 | public function countFrames() : int |
|
158 | } |
||
159 |