| Conditions | 2 |
| Paths | 2 |
| Total Lines | 16 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 48 | public function handle(Query $query): DTO |
||
| 49 | { |
||
| 50 | /** @var HandledStamp $handlerResult */ |
||
| 51 | $handlerResult = $this->wrappedMessageBus->dispatch(new Envelope($query)) |
||
| 52 | ->last(HandledStamp::class); |
||
| 53 | $dto = $handlerResult->getResult(); |
||
| 54 | |||
| 55 | if (!$dto instanceof DTO) { |
||
| 56 | throw new QueryReturnException(\sprintf( |
||
| 57 | 'Query handler for %s should return an instance of %s', |
||
| 58 | \get_class($query), |
||
| 59 | DTO::class |
||
| 60 | )); |
||
| 61 | } |
||
| 62 | |||
| 63 | return $dto; |
||
| 64 | } |
||
| 66 |