1 | <?php |
||
17 | class StreamedClientIo extends AbstractClientIo |
||
18 | { |
||
19 | /** |
||
20 | * Read attempts count |
||
21 | */ |
||
22 | const READ_ATTEMPTS = 2; |
||
23 | |||
24 | /** |
||
25 | * Amount of read attempts |
||
26 | * |
||
27 | * @var int |
||
28 | */ |
||
29 | private $readAttempts = self::READ_ATTEMPTS; |
||
30 | |||
31 | /** |
||
32 | * Remote socket address |
||
33 | * |
||
34 | * @var string |
||
35 | */ |
||
36 | private $remoteAddress; |
||
37 | |||
38 | /** {@inheritdoc} */ |
||
39 | 18 | protected function readRawDataIntoPicker(FramePickerInterface $picker) |
|
62 | |||
63 | /** |
||
64 | * Calculate attempts value |
||
65 | * |
||
66 | * @param array $context Read context |
||
67 | * @param int $currentAttempts Current attempts counter |
||
68 | * |
||
69 | * @return int |
||
70 | */ |
||
71 | 17 | private function resolveReadAttempts(array $context, $currentAttempts) |
|
79 | |||
80 | /** {@inheritdoc} */ |
||
81 | 4 | protected function writeRawData($data) |
|
96 | |||
97 | /** {@inheritdoc} */ |
||
98 | 24 | protected function isConnected() |
|
102 | |||
103 | /** {@inheritdoc} */ |
||
104 | 17 | protected function getRemoteAddress() |
|
112 | |||
113 | /** |
||
114 | * Checks whether data read from stream buffer can be filled later |
||
115 | * |
||
116 | * @param string $data Read data |
||
117 | * |
||
118 | * @return bool |
||
119 | */ |
||
120 | 17 | private function isReadDataActuallyEmpty($data) |
|
130 | |||
131 | /** {@inheritdoc} */ |
||
132 | 17 | protected function isEndOfTransfer() |
|
136 | |||
137 | /** {@inheritdoc} */ |
||
138 | 4 | protected function canReachFrame() |
|
142 | |||
143 | /** |
||
144 | * Return first byte from socket buffer |
||
145 | * |
||
146 | * @return string |
||
147 | */ |
||
148 | 18 | private function getDataInSocket() |
|
152 | |||
153 | /** |
||
154 | * Return remote address if we connected or false otherwise |
||
155 | * |
||
156 | * @return string|bool |
||
157 | */ |
||
158 | 24 | private function resolveRemoteAddress() |
|
162 | } |
||
163 |