Code Coverage
 
Lines
Branches
Paths
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
8 / 8
100.00% covered (success)
100.00%
2 / 2
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
ReportController
100.00% covered (success)
100.00%
8 / 8
100.00% covered (success)
100.00%
2 / 2
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
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 __invoke
100.00% covered (success)
100.00%
7 / 7
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3namespace App\Controller;
4
5use App\Application\UseCase\CreateReportInterface;
6use App\Dto\Command\CreateReportCommand;
7use App\Dto\Request\ReportRequest;
8use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
9use Symfony\Component\HttpFoundation\JsonResponse;
10use Symfony\Component\HttpFoundation\Response;
11use Symfony\Component\HttpKernel\Attribute\MapRequestPayload;
12use Symfony\Component\Routing\Attribute\Route;
13
14/**
15 * @author Wilhelm Zwertvaegher
16 */
17#[Route('/api/report')]
18class 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}

Branches

Below are the source code lines that represent each code branch as identified by Xdebug. Please note a branch is not necessarily coterminous with a line, a line may contain multiple branches and therefore show up more than once. Please also be aware that some branches may be implicit rather than explicit, e.g. an if statement always has an else as part of its logical flow even if you didn't write one.

ReportController->__construct
20    public function __construct(private readonly CreateReportInterface $report)
21    {
22    }
ReportController->__invoke
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    }
{main}
3namespace App\Controller;
4
5use App\Application\UseCase\CreateReportInterface;
6use App\Dto\Command\CreateReportCommand;
7use App\Dto\Request\ReportRequest;
8use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
9use Symfony\Component\HttpFoundation\JsonResponse;
10use Symfony\Component\HttpFoundation\Response;
11use Symfony\Component\HttpKernel\Attribute\MapRequestPayload;
12use Symfony\Component\Routing\Attribute\Route;
13
14/**
15 * @author Wilhelm Zwertvaegher
16 */
17#[Route('/api/report')]
18class 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    }