1 | <?php |
||
37 | class Client extends Application implements ClientInterface |
||
38 | { |
||
39 | use TimersAware; |
||
40 | |||
41 | /** |
||
42 | * @var string |
||
43 | */ |
||
44 | const LOGO = <<<EOT |
||
45 | _____ _____ _ _ _ _____ |
||
46 | / ___/ | _ \ | | | | / / | ____| |
||
47 | | |___ | |_| | | | | |/ / | |__ |
||
48 | \___ \ | ___/ | | | |\ \ | __| |
||
49 | ___| | | | | | | | \ \ | |___ |
||
50 | /_____/ |_| |_| |_| \_\ |_____| |
||
51 | |||
52 | |||
53 | EOT; |
||
54 | |||
55 | /** |
||
56 | * @var string |
||
57 | */ |
||
58 | const NAME = 'Spike Client'; |
||
59 | |||
60 | /** |
||
61 | * @var string |
||
62 | */ |
||
63 | protected $id; |
||
64 | |||
65 | /** |
||
66 | * @var Configuration |
||
67 | */ |
||
68 | protected $configuration; |
||
69 | |||
70 | /** |
||
71 | * @var LoopInterface |
||
72 | */ |
||
73 | protected $eventLoop; |
||
74 | |||
75 | /** |
||
76 | * @var DispatcherInterface |
||
77 | */ |
||
78 | protected $eventDispatcher; |
||
79 | |||
80 | /** |
||
81 | * @var ConnectionInterface |
||
82 | */ |
||
83 | protected $controlConnection; |
||
84 | |||
85 | /** |
||
86 | * @var \DateTimeInterface |
||
87 | */ |
||
88 | protected $activeAt; |
||
89 | |||
90 | /** |
||
91 | * @var WorkerInterface[]|Collection |
||
92 | */ |
||
93 | protected $workers; |
||
94 | |||
95 | /** |
||
96 | * @var Logger |
||
97 | */ |
||
98 | protected $logger; |
||
99 | |||
100 | public function __construct(Configuration $configuration, LoopInterface $eventLoop = null) |
||
109 | |||
110 | /** |
||
111 | * {@inheritdoc} |
||
112 | */ |
||
113 | public function getHelp() |
||
117 | |||
118 | /** |
||
119 | * {@inheritdoc} |
||
120 | * |
||
121 | * @codeCoverageIgnore |
||
122 | */ |
||
123 | public function doRun(InputInterface $input, OutputInterface $output) |
||
142 | |||
143 | /** |
||
144 | * Start Connect to Server. |
||
145 | * |
||
146 | * @return int |
||
147 | */ |
||
148 | protected function start() |
||
162 | |||
163 | /** |
||
164 | * Handles the control connection. |
||
165 | * |
||
166 | * @param ConnectionInterface $connection |
||
167 | * @codeCoverageIgnore |
||
168 | */ |
||
169 | protected function handleControlConnection(ConnectionInterface $connection) |
||
205 | |||
206 | /** |
||
207 | * Request for auth. |
||
208 | * |
||
209 | * @param ConnectionInterface $connection |
||
210 | * @codeCoverageIgnore |
||
211 | */ |
||
212 | protected function sendAuthRequest(ConnectionInterface $connection) |
||
221 | |||
222 | /** |
||
223 | * @return Configuration |
||
224 | */ |
||
225 | public function getConfiguration() |
||
229 | |||
230 | /** |
||
231 | * {@inheritdoc} |
||
232 | */ |
||
233 | public function getControlConnection() |
||
237 | |||
238 | /** |
||
239 | * {@inheritdoc} |
||
240 | */ |
||
241 | public function getId() |
||
245 | |||
246 | /** |
||
247 | * {@inheritdoc} |
||
248 | */ |
||
249 | public function setId($id) |
||
253 | |||
254 | /** |
||
255 | * {@inheritdoc} |
||
256 | */ |
||
257 | public function getActiveAt() |
||
261 | |||
262 | /** |
||
263 | * {@inheritdoc} |
||
264 | */ |
||
265 | public function getEventDispatcher() |
||
269 | |||
270 | /** |
||
271 | * @param \DateTimeInterface $activeAt |
||
272 | */ |
||
273 | public function setActiveAt($activeAt) |
||
277 | |||
278 | /** |
||
279 | * @return LoopInterface |
||
280 | */ |
||
281 | public function getEventLoop() |
||
285 | |||
286 | /** |
||
287 | * @return Collection|WorkerInterface[] |
||
288 | */ |
||
289 | public function getWorkers() |
||
293 | |||
294 | /** |
||
295 | * @return Logger |
||
296 | */ |
||
297 | public function getLogger() |
||
301 | |||
302 | /** |
||
303 | * {@inheritdoc} |
||
304 | */ |
||
305 | protected function getDefaultCommands() |
||
312 | |||
313 | protected function initializeEvents() |
||
318 | |||
319 | /** |
||
320 | * Creates default timers. |
||
321 | * |
||
322 | * @codeCoverageIgnore |
||
323 | */ |
||
324 | protected function initializeTimers() |
||
328 | } |
In PHP, under loose comparison (like
==
, or!=
, orswitch
conditions), values of different types might be equal.For
string
values, the empty string''
is a special case, in particular the following results might be unexpected: