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 |
| SuggestionController | |
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\CreateSuggestionInterface; |
| 6 | use App\Dto\Command\CreateSuggestionCommand; |
| 7 | use App\Dto\Request\SuggestionRequest; |
| 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/suggestion')] |
| 18 | class SuggestionController extends AbstractController |
| 19 | { |
| 20 | public function __construct(private readonly CreateSuggestionInterface $suggestion) |
| 21 | { |
| 22 | } |
| 23 | |
| 24 | #[Route('', name: 'api_suggestion', methods: ['POST'])] |
| 25 | public function __invoke(#[MapRequestPayload] SuggestionRequest $request): JsonResponse |
| 26 | { |
| 27 | $suggestionCommand = new CreateSuggestionCommand( |
| 28 | label: $request->getLabel(), |
| 29 | senderEmail: $request->getSenderEmail() |
| 30 | ); |
| 31 | ($this->suggestion)($suggestionCommand); |
| 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 CreateSuggestionInterface $suggestion) |
| 21 | { |
| 22 | } |
| 25 | public function __invoke(#[MapRequestPayload] SuggestionRequest $request): JsonResponse |
| 26 | { |
| 27 | $suggestionCommand = new CreateSuggestionCommand( |
| 28 | label: $request->getLabel(), |
| 29 | senderEmail: $request->getSenderEmail() |
| 30 | ); |
| 31 | ($this->suggestion)($suggestionCommand); |
| 32 | |
| 33 | return new JsonResponse(null, Response::HTTP_CREATED); |
| 34 | } |
| 3 | namespace App\Controller; |
| 4 | |
| 5 | use App\Application\UseCase\CreateSuggestionInterface; |
| 6 | use App\Dto\Command\CreateSuggestionCommand; |
| 7 | use App\Dto\Request\SuggestionRequest; |
| 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/suggestion')] |
| 18 | class SuggestionController extends AbstractController |
| 19 | { |
| 20 | public function __construct(private readonly CreateSuggestionInterface $suggestion) |
| 21 | { |
| 22 | } |
| 23 | |
| 24 | #[Route('', name: 'api_suggestion', methods: ['POST'])] |
| 25 | public function __invoke(#[MapRequestPayload] SuggestionRequest $request): JsonResponse |
| 26 | { |
| 27 | $suggestionCommand = new CreateSuggestionCommand( |
| 28 | label: $request->getLabel(), |
| 29 | senderEmail: $request->getSenderEmail() |
| 30 | ); |
| 31 | ($this->suggestion)($suggestionCommand); |
| 32 | |
| 33 | return new JsonResponse(null, Response::HTTP_CREATED); |
| 34 | } |