Code Coverage
 
Lines
Branches
Paths
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 5
0.00% covered (danger)
0.00%
0 / 4
0.00% covered (danger)
0.00%
0 / 3
0.00% covered (danger)
0.00%
0 / 2
CRAP
0.00% covered (danger)
0.00%
0 / 1
PartController
0.00% covered (danger)
0.00%
0 / 5
0.00% covered (danger)
0.00%
0 / 4
0.00% covered (danger)
0.00%
0 / 3
0.00% covered (danger)
0.00%
0 / 2
12
0.00% covered (danger)
0.00%
0 / 1
 __construct
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 searchPart
0.00% covered (danger)
0.00%
0 / 4
0.00% covered (danger)
0.00%
0 / 3
0.00% covered (danger)
0.00%
0 / 2
0.00% covered (danger)
0.00%
0 / 1
6
1<?php
2
3namespace App\CollectionManagement\Infrastructure\Controller;
4
5use App\CollectionManagement\Application\Command\SearchPartQuery;
6use App\CollectionManagement\Application\Handler\SearchPartHandler;
7use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
8use Symfony\Component\HttpFoundation\JsonResponse;
9use Symfony\Component\HttpFoundation\Request;
10use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
11use Symfony\Component\Routing\Attribute\Route;
12
13#[Route('/api/parts')]
14class PartController extends AbstractController
15{
16    public function __construct(
17        private readonly SearchPartHandler $searchPartHandler
18    )
19    {}
20
21    #[Route('', methods: ['GET', 'HEAD'])]
22    public function searchPart(Request $request): JsonResponse
23    {
24        if(!$request->query->has('q')) {
25            throw new BadRequestHttpException();
26        }
27        $query = new SearchPartQuery($request->get('q'));
28        return $this->json(($this->searchPartHandler)($query));
29    }
30}

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.

PartController->__construct
16    public function __construct(
17        private readonly SearchPartHandler $searchPartHandler
18    )
19    {}
PartController->searchPart
22    public function searchPart(Request $request): JsonResponse
23    {
24        if(!$request->query->has('q')) {
25            throw new BadRequestHttpException();
27        $query = new SearchPartQuery($request->get('q'));
28        return $this->json(($this->searchPartHandler)($query));
29    }
{main}
3namespace App\CollectionManagement\Infrastructure\Controller;
4
5use App\CollectionManagement\Application\Command\SearchPartQuery;
6use App\CollectionManagement\Application\Handler\SearchPartHandler;
7use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
8use Symfony\Component\HttpFoundation\JsonResponse;
9use Symfony\Component\HttpFoundation\Request;
10use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
11use Symfony\Component\Routing\Attribute\Route;
12
13#[Route('/api/parts')]
14class PartController extends AbstractController
15{
16    public function __construct(
17        private readonly SearchPartHandler $searchPartHandler
18    )
19    {}
20
21    #[Route('', methods: ['GET', 'HEAD'])]
22    public function searchPart(Request $request): JsonResponse
23    {
24        if(!$request->query->has('q')) {
25            throw new BadRequestHttpException();
26        }
27        $query = new SearchPartQuery($request->get('q'));
28        return $this->json(($this->searchPartHandler)($query));
29    }