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