| Conditions | 2 |
| Paths | 3 |
| Total Lines | 13 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 17 | public function __invoke(string $postId): JsonResponse |
||
| 18 | { |
||
| 19 | $this->bus->addHandler(FindPostQuery::class, FindPostQueryHandler::class); |
||
| 20 | $this->bus->addHandler(IncreaseVisualizationsCommand::class, IncreaseVisualizationsCommandHandler::class); |
||
| 21 | |||
| 22 | try { |
||
| 23 | $this->bus->dispatch(new IncreaseVisualizationsCommand($postId)); |
||
| 24 | |||
| 25 | return JsonResponse::create( |
||
| 26 | $this->bus->dispatch(new FindPostQuery($postId)) |
||
| 27 | ); |
||
| 28 | } catch (PostNotExist $e) { |
||
| 29 | return JsonResponse::create(['message' => $e->getMessage()], 404); |
||
| 30 | } |
||
| 33 |