Code Coverage |
||||||||||||||||
Lines |
Branches |
Paths |
Functions and Methods |
Classes and Traits |
||||||||||||
| Total | |
100.00% |
7 / 7 |
|
100.00% |
2 / 2 |
|
100.00% |
2 / 2 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
1 / 1 |
| ContactController | |
100.00% |
7 / 7 |
|
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% |
6 / 6 |
|
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\CreateContactInterface; |
| 6 | use App\Dto\Command\CreateContactCommand; |
| 7 | use App\Dto\Request\ContactRequest; |
| 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/contact')] |
| 18 | class ContactController extends AbstractController |
| 19 | { |
| 20 | public function __construct(private readonly CreateContactInterface $contact) |
| 21 | { |
| 22 | } |
| 23 | |
| 24 | #[Route('', name: 'api_contact', methods: ['POST'])] |
| 25 | public function __invoke(#[MapRequestPayload] ContactRequest $request): JsonResponse |
| 26 | { |
| 27 | $contactCommand = new CreateContactCommand( |
| 28 | $request->getSenderEmail(), |
| 29 | $request->getContent() |
| 30 | ); |
| 31 | ($this->contact)($contactCommand); |
| 32 | |
| 33 | return new JsonResponse(null, Response::HTTP_CREATED); |
| 34 | } |
| 35 | } |
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.
| 20 | public function __construct(private readonly CreateContactInterface $contact) |
| 21 | { |
| 22 | } |
| 25 | public function __invoke(#[MapRequestPayload] ContactRequest $request): JsonResponse |
| 26 | { |
| 27 | $contactCommand = new CreateContactCommand( |
| 28 | $request->getSenderEmail(), |
| 29 | $request->getContent() |
| 30 | ); |
| 31 | ($this->contact)($contactCommand); |
| 32 | |
| 33 | return new JsonResponse(null, Response::HTTP_CREATED); |
| 34 | } |
| 3 | namespace App\Controller; |
| 4 | |
| 5 | use App\Application\UseCase\CreateContactInterface; |
| 6 | use App\Dto\Command\CreateContactCommand; |
| 7 | use App\Dto\Request\ContactRequest; |
| 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/contact')] |
| 18 | class ContactController extends AbstractController |
| 19 | { |
| 20 | public function __construct(private readonly CreateContactInterface $contact) |
| 21 | { |
| 22 | } |
| 23 | |
| 24 | #[Route('', name: 'api_contact', methods: ['POST'])] |
| 25 | public function __invoke(#[MapRequestPayload] ContactRequest $request): JsonResponse |
| 26 | { |
| 27 | $contactCommand = new CreateContactCommand( |
| 28 | $request->getSenderEmail(), |
| 29 | $request->getContent() |
| 30 | ); |
| 31 | ($this->contact)($contactCommand); |
| 32 | |
| 33 | return new JsonResponse(null, Response::HTTP_CREATED); |
| 34 | } |