Code Coverage
 
Lines
Branches
Paths
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
4 / 4
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
CreateApiKey
100.00% covered (success)
100.00%
4 / 4
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%
3 / 3
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\Application\UseCase;
4
5use App\Dto\Response\ApiKeyDto;
6use App\Service\Data\ApiKeyServiceInterface;
7use Doctrine\ORM\EntityManagerInterface;
8
9class CreateApiKey implements CreateApiKeyInterface
10{
11    public function __construct(
12        private readonly ApiKeyServiceInterface $apiKeyService,
13        private readonly EntityManagerInterface $entityManager,
14    ) {
15    }
16
17    public function __invoke(): ApiKeyDto
18    {
19        $created = $this->apiKeyService->createKey();
20
21        $this->entityManager->flush();
22
23        return new ApiKeyDto($created->getRawApiKey());
24    }
25}

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.

CreateApiKey->__construct
11    public function __construct(
12        private readonly ApiKeyServiceInterface $apiKeyService,
13        private readonly EntityManagerInterface $entityManager,
14    ) {
15    }
CreateApiKey->__invoke
19        $created = $this->apiKeyService->createKey();
20
21        $this->entityManager->flush();
22
23        return new ApiKeyDto($created->getRawApiKey());
24    }
{main}
3namespace App\Application\UseCase;
4
5use App\Dto\Response\ApiKeyDto;
6use App\Service\Data\ApiKeyServiceInterface;
7use Doctrine\ORM\EntityManagerInterface;
8
9class CreateApiKey implements CreateApiKeyInterface
10{
11    public function __construct(
12        private readonly ApiKeyServiceInterface $apiKeyService,
13        private readonly EntityManagerInterface $entityManager,
14    ) {
15    }
16
17    public function __invoke(): ApiKeyDto
18    {
19        $created = $this->apiKeyService->createKey();
20
21        $this->entityManager->flush();
22
23        return new ApiKeyDto($created->getRawApiKey());
24    }