Code Coverage |
||||||||||||||||
Lines |
Branches |
Paths |
Functions and Methods |
Classes and Traits |
||||||||||||
| Total | |
100.00% |
8 / 8 |
|
100.00% |
2 / 2 |
|
100.00% |
2 / 2 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
1 / 1 |
| ReportController | |
100.00% |
8 / 8 |
|
100.00% |
2 / 2 |
|
100.00% |
2 / 2 |
|
100.00% |
2 / 2 |
2 | |
100.00% |
1 / 1 |
| __construct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| __invoke | |
100.00% |
7 / 7 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace App\Controller; |
| 4 | |
| 5 | use App\Application\UseCase\CreateReportInterface; |
| 6 | use App\Dto\Command\CreateReportCommand; |
| 7 | use App\Dto\Request\ReportRequest; |
| 8 | use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; |
| 9 | use Symfony\Component\HttpFoundation\JsonResponse; |
| 10 | use Symfony\Component\HttpFoundation\Response; |
| 11 | use Symfony\Component\HttpKernel\Attribute\MapRequestPayload; |
| 12 | use Symfony\Component\Routing\Attribute\Route; |
| 13 | |
| 14 | /** |
| 15 | * @author Wilhelm Zwertvaegher |
| 16 | */ |
| 17 | #[Route('/api/report')] |
| 18 | class ReportController extends AbstractController |
| 19 | { |
| 20 | public function __construct(private readonly CreateReportInterface $report) |
| 21 | { |
| 22 | } |
| 23 | |
| 24 | #[Route('', name: 'api_report', methods: ['POST'])] |
| 25 | public function __invoke(#[MapRequestPayload] ReportRequest $request): JsonResponse |
| 26 | { |
| 27 | $reportCommand = new CreateReportCommand( |
| 28 | $request->getSenderEmail(), |
| 29 | $request->getReason(), |
| 30 | $request->getNickId() |
| 31 | ); |
| 32 | ($this->report)($reportCommand); |
| 33 | |
| 34 | return new JsonResponse(null, Response::HTTP_CREATED); |
| 35 | } |
| 36 | } |
Below are the source code lines that represent each code path as identified by Xdebug. Please note a path is not
necessarily coterminous with a line, a line may contain multiple paths and therefore show up more than once.
Please also be aware that some paths may include implicit rather than explicit branches, e.g. an if statement
always has an else as part of its logical flow even if you didn't write one.
| 20 | public function __construct(private readonly CreateReportInterface $report) |
| 21 | { |
| 22 | } |
| 25 | public function __invoke(#[MapRequestPayload] ReportRequest $request): JsonResponse |
| 26 | { |
| 27 | $reportCommand = new CreateReportCommand( |
| 28 | $request->getSenderEmail(), |
| 29 | $request->getReason(), |
| 30 | $request->getNickId() |
| 31 | ); |
| 32 | ($this->report)($reportCommand); |
| 33 | |
| 34 | return new JsonResponse(null, Response::HTTP_CREATED); |
| 35 | } |
| 3 | namespace App\Controller; |
| 4 | |
| 5 | use App\Application\UseCase\CreateReportInterface; |
| 6 | use App\Dto\Command\CreateReportCommand; |
| 7 | use App\Dto\Request\ReportRequest; |
| 8 | use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; |
| 9 | use Symfony\Component\HttpFoundation\JsonResponse; |
| 10 | use Symfony\Component\HttpFoundation\Response; |
| 11 | use Symfony\Component\HttpKernel\Attribute\MapRequestPayload; |
| 12 | use Symfony\Component\Routing\Attribute\Route; |
| 13 | |
| 14 | /** |
| 15 | * @author Wilhelm Zwertvaegher |
| 16 | */ |
| 17 | #[Route('/api/report')] |
| 18 | class ReportController extends AbstractController |
| 19 | { |
| 20 | public function __construct(private readonly CreateReportInterface $report) |
| 21 | { |
| 22 | } |
| 23 | |
| 24 | #[Route('', name: 'api_report', methods: ['POST'])] |
| 25 | public function __invoke(#[MapRequestPayload] ReportRequest $request): JsonResponse |
| 26 | { |
| 27 | $reportCommand = new CreateReportCommand( |
| 28 | $request->getSenderEmail(), |
| 29 | $request->getReason(), |
| 30 | $request->getNickId() |
| 31 | ); |
| 32 | ($this->report)($reportCommand); |
| 33 | |
| 34 | return new JsonResponse(null, Response::HTTP_CREATED); |
| 35 | } |