Conditions | 3 |
Paths | 3 |
Total Lines | 13 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
35 | public function getHandlerForMessage(object $message): callable |
||
36 | { |
||
37 | $class = get_class($message); |
||
38 | $id = $this->handlers[$class] ?? null; |
||
39 | |||
40 | if (!$id) { |
||
41 | throw new NotFound("No handler for messages of type `$class`."); |
||
42 | } |
||
43 | |||
44 | try { |
||
45 | return $this->container->get($id); // @phpstan-ignore-line |
||
46 | } catch (NotFoundExceptionInterface $e) { |
||
47 | throw new NotFound("No handler for messages of type `$class`.", $e); |
||
48 | } |
||
51 |