1 | <?php |
||
27 | class Connection implements ConnectionInterface, WireSubscriberInterface |
||
28 | { |
||
29 | const STATUS_CLOSED = 'closed'; |
||
30 | const STATUS_READY = 'ready'; |
||
31 | const STATUS_BLOCKED = 'blocked'; |
||
32 | |||
33 | /** |
||
34 | * @var Url |
||
35 | */ |
||
36 | private $url; |
||
37 | |||
38 | /** |
||
39 | * @var WireInterface |
||
40 | */ |
||
41 | private $wire; |
||
42 | |||
43 | /** |
||
44 | * @var AuthenticatorInterface |
||
45 | */ |
||
46 | private $authenticator; |
||
47 | |||
48 | /** |
||
49 | * @var string |
||
50 | */ |
||
51 | private $status; |
||
52 | |||
53 | /** |
||
54 | * @var Channel[] |
||
55 | */ |
||
56 | private $channels = []; |
||
57 | |||
58 | /** |
||
59 | * @var array |
||
60 | */ |
||
61 | private $capabilities = []; |
||
62 | |||
63 | /** |
||
64 | * @param Url|string $url |
||
65 | * @param WireInterface $wire |
||
66 | * @param AuthenticatorInterface $authenticator |
||
67 | */ |
||
68 | 31 | public function __construct(Url $url, WireInterface $wire, AuthenticatorInterface $authenticator = null) |
|
74 | |||
75 | /** |
||
76 | * Connection status. See STATUS_* constants for possible values. |
||
77 | * |
||
78 | * @return string |
||
79 | */ |
||
80 | 4 | public function getStatus() |
|
84 | |||
85 | /** |
||
86 | * {@inheritdoc} |
||
87 | */ |
||
88 | 19 | public function open() |
|
105 | |||
106 | /** |
||
107 | * {@inheritdoc} |
||
108 | */ |
||
109 | 19 | public function channel($id = null) |
|
126 | |||
127 | /** |
||
128 | * {@inheritdoc} |
||
129 | */ |
||
130 | 7 | public function close($code = 0, $reason = '') |
|
141 | |||
142 | /** |
||
143 | * {@inheritdoc} |
||
144 | */ |
||
145 | 1 | public function isSupported($capability) |
|
150 | |||
151 | /** |
||
152 | * {@inheritdoc} |
||
153 | */ |
||
154 | 10 | public function serve($blocking = true) |
|
160 | |||
161 | /** |
||
162 | * Sends frame to the service channel (#0). |
||
163 | * |
||
164 | * @param Frame $frame |
||
165 | * |
||
166 | * @return $this |
||
167 | */ |
||
168 | 26 | private function send(Frame $frame) |
|
174 | |||
175 | /** |
||
176 | * Wait for a frame in the service channel (#0). |
||
177 | * |
||
178 | * @param string|array $type |
||
179 | * |
||
180 | * @return Frame |
||
181 | */ |
||
182 | 20 | private function wait($type) |
|
186 | |||
187 | /** |
||
188 | * {@inheritdoc} |
||
189 | */ |
||
190 | 26 | public function dispatch(Frame $frame) |
|
204 | |||
205 | /** |
||
206 | * This frame is the first frame received from server. |
||
207 | * It provides server details and requests client credentials. |
||
208 | * |
||
209 | * @param ConnectionStart $frame |
||
210 | */ |
||
211 | 20 | private function onConnectionStart(ConnectionStart $frame) |
|
243 | |||
244 | /** |
||
245 | * This frame is received to setup connection preferences, like max frame size, |
||
246 | * max number of channel and heartbeat delay. |
||
247 | * |
||
248 | * Values in the request can be lowered by client. |
||
249 | * |
||
250 | * @param ConnectionTune $frame |
||
251 | */ |
||
252 | private function onConnectionTune(ConnectionTune $frame) |
||
267 | |||
268 | /** |
||
269 | * This frame is received once server decide to close connection, normally because an unrecoverable error occur. |
||
270 | * |
||
271 | * @param ConnectionClose $frame |
||
272 | * |
||
273 | * @throws AMQPException |
||
274 | */ |
||
275 | 3 | private function onConnectionClose(ConnectionClose $frame) |
|
286 | |||
287 | /** |
||
288 | * This frame is received once server decide to suspend connection, for example because server |
||
289 | * run out of memory and can not provide service for the connection. When this happen consumer |
||
290 | * suppose to suspend all activities until connection.unblocked is received. |
||
291 | * |
||
292 | * @param ConnectionBlocked $frame |
||
293 | */ |
||
294 | 1 | private function onConnectionBlocked(ConnectionBlocked $frame) |
|
298 | |||
299 | /** |
||
300 | * This frame is received once connection returns back to normal state after being suspended. |
||
301 | * See onConnectionBlocked above. |
||
302 | * |
||
303 | * @param ConnectionUnblocked $frame |
||
304 | */ |
||
305 | 1 | private function onConnectionUnblocked(ConnectionUnblocked $frame) |
|
309 | } |
||
310 |
This error could be the result of:
1. Missing dependencies
PHP Analyzer uses your
composer.json
file (if available) to determine the dependencies of your project and to determine all the available classes and functions. It expects thecomposer.json
to be in the root folder of your repository.Are you sure this class is defined by one of your dependencies, or did you maybe not list a dependency in either the
require
orrequire-dev
section?2. Missing use statement
PHP does not complain about undefined classes in
ìnstanceof
checks. For example, the following PHP code will work perfectly fine:If you have not tested against this specific condition, such errors might go unnoticed.