Code Coverage |
||||||||||||||||
Lines |
Branches |
Paths |
Functions and Methods |
Classes and Traits |
||||||||||||
| Total | |
100.00% |
4 / 4 |
|
100.00% |
2 / 2 |
|
100.00% |
2 / 2 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
1 / 1 |
| CreateApiKey | |
100.00% |
4 / 4 |
|
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% |
3 / 3 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace App\Application\UseCase; |
| 4 | |
| 5 | use App\Dto\Response\ApiKeyDto; |
| 6 | use App\Service\Data\ApiKeyServiceInterface; |
| 7 | use Doctrine\ORM\EntityManagerInterface; |
| 8 | |
| 9 | class 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 | } |