| Total Complexity | 3 |
| Total Lines | 34 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 14 | #[Route('/api/comments')] |
||
| 15 | class CommentsQueryController extends AbstractController |
||
| 16 | { |
||
| 17 | /** |
||
| 18 | * @param CommentsApiInterface $commentsApi |
||
| 19 | */ |
||
| 20 | 1 | public function __construct( |
|
| 21 | private CommentsApiInterface $commentsApi |
||
| 22 | ) |
||
| 23 | { |
||
| 24 | 1 | } |
|
| 25 | |||
| 26 | /** |
||
| 27 | * @param string $postId |
||
| 28 | * @return Response |
||
| 29 | */ |
||
| 30 | 1 | #[Route('/{postId}', methods: ['GET'])] |
|
| 31 | public function getCommentsForPost(string $postId): Response |
||
| 32 | { |
||
| 33 | 1 | return $this->json( |
|
| 34 | 1 | $this->commentsApi->findCommentsForPost(new FindCommentsByPostIdQuery(new Ulid($postId))) |
|
| 35 | ); |
||
| 36 | } |
||
| 37 | |||
| 38 | /** |
||
| 39 | * @param Request $request |
||
| 40 | * @return Response |
||
| 41 | */ |
||
| 42 | 1 | #[Route('/', methods: ['GET'])] |
|
| 48 | ); |
||
| 49 | } |
||
| 50 | } |