Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
2 / 2
CRAP
100.00% covered (success)
100.00%
1 / 1
ListCurrenciesController
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
2 / 2
2
100.00% covered (success)
100.00%
1 / 1
 __construct
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 list
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3declare(strict_types=1);
4
5namespace App\Currency\Infrastructure\Controllers;
6
7use App\Currency\Application\Query\ListCurrenciesHandler;
8use App\Currency\Application\Query\ListCurrenciesQuery;
9use OpenApi\Attributes as OA;
10use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
11use Symfony\Component\HttpFoundation\JsonResponse;
12use Symfony\Component\Routing\Attribute\Route;
13
14#[OA\Tag(name: 'Currencies')]
15class ListCurrenciesController extends AbstractController
16{
17    public function __construct(
18        private readonly ListCurrenciesHandler $handler,
19    ) {
20    }
21
22    #[Route('/currencies', name: 'currencies_list', methods: ['GET'])]
23    public function list(): JsonResponse
24    {
25        return new JsonResponse($this->handler->handle(new ListCurrenciesQuery()));
26    }
27}