1 | <?php |
||
16 | class Dispatcher implements DispatcherInterface |
||
17 | { |
||
18 | /** |
||
19 | * Dispatcher driver |
||
20 | * |
||
21 | * @var DriverInterface |
||
22 | */ |
||
23 | private $driver; |
||
24 | |||
25 | /** |
||
26 | * Logger |
||
27 | * |
||
28 | * @var LoggerInterface |
||
29 | */ |
||
30 | private $logger; |
||
31 | |||
32 | /** |
||
33 | * Restart |
||
34 | * |
||
35 | * @var RestartInterface |
||
36 | */ |
||
37 | private $restart; |
||
38 | |||
39 | /** |
||
40 | * All registered handlers |
||
41 | * |
||
42 | * @var HandlerInterface[][] |
||
43 | */ |
||
44 | private $handlers = []; |
||
45 | |||
46 | /** |
||
47 | * @var DateTime |
||
48 | */ |
||
49 | private $startTime; |
||
50 | |||
51 | /** |
||
52 | * Create new Dispatcher |
||
53 | * |
||
54 | * @param DriverInterface $driver |
||
55 | * @param LoggerInterface $logger |
||
56 | * @param RestartInterface $restart |
||
57 | */ |
||
58 | 24 | public function __construct(DriverInterface $driver, LoggerInterface $logger = null, RestartInterface $restart = null) |
|
65 | |||
66 | /** |
||
67 | * {@inheritdoc} |
||
68 | */ |
||
69 | 6 | public function emit(MessageInterface $message) |
|
80 | |||
81 | /** |
||
82 | * Basic method for background job to star listening. |
||
83 | * |
||
84 | * This method hook to driver wait() method and start listening events. |
||
85 | * Method is blocking, so when you call it all processing will stop. |
||
86 | * WARNING! Don't use it on web server calls. Run it only with cli. |
||
87 | * |
||
88 | * @return void |
||
89 | */ |
||
90 | public function handle() |
||
112 | |||
113 | /** |
||
114 | * Dispatch message |
||
115 | * |
||
116 | * @param MessageInterface $message |
||
117 | * |
||
118 | * @return bool |
||
119 | */ |
||
120 | 18 | private function dispatch(MessageInterface $message) |
|
140 | |||
141 | /** |
||
142 | * Handle given message with given handler |
||
143 | * |
||
144 | * @param HandlerInterface $handler |
||
145 | * @param MessageInterface $message |
||
146 | * |
||
147 | * @return bool |
||
148 | */ |
||
149 | 15 | private function handleMessage(HandlerInterface $handler, MessageInterface $message) |
|
175 | |||
176 | /** |
||
177 | * Check if actual dispatcher has handler for given type |
||
178 | * |
||
179 | * @param string $type |
||
180 | * |
||
181 | * @return bool |
||
182 | */ |
||
183 | 18 | private function hasHandlers($type) |
|
187 | |||
188 | /** |
||
189 | * {@inheritdoc} |
||
190 | */ |
||
191 | 18 | public function registerHandler($type, HandlerInterface $handler) |
|
199 | |||
200 | /** |
||
201 | * Serialize message to logger context |
||
202 | * |
||
203 | * @param MessageInterface $message |
||
204 | * |
||
205 | * @return array |
||
206 | */ |
||
207 | 24 | private function messageLoggerContext(MessageInterface $message) |
|
216 | |||
217 | /** |
||
218 | * Interal log method wrapper |
||
219 | * |
||
220 | * @param string $level |
||
221 | * @param string $message |
||
222 | * @param array $context |
||
223 | * |
||
224 | * @return void |
||
225 | */ |
||
226 | 24 | private function log($level, $message, array $context = array()) |
|
232 | } |
||
233 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.