Code Coverage |
||||||||||||||||
Lines |
Branches |
Paths |
Functions and Methods |
Classes and Traits |
||||||||||||
| Total | |
100.00% |
8 / 8 |
|
100.00% |
2 / 2 |
|
100.00% |
2 / 2 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
1 / 1 |
| GenerateNick | |
100.00% |
8 / 8 |
|
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% |
7 / 7 |
|
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\Command\GenerateNickCommand; |
| 6 | use App\Dto\Result\GeneratedNickData; |
| 7 | use App\Service\Data\NickServiceInterface; |
| 8 | use App\Service\Data\QualifierServiceInterface; |
| 9 | use App\Service\Data\SubjectServiceInterface; |
| 10 | use App\Service\Generator\NickGeneratorServiceInterface; |
| 11 | use Doctrine\ORM\EntityManagerInterface; |
| 12 | |
| 13 | /** |
| 14 | * @author Wilhelm Zwertvaegher |
| 15 | */ |
| 16 | readonly class GenerateNick implements GenerateNickInterface |
| 17 | { |
| 18 | public function __construct( |
| 19 | private NickGeneratorServiceInterface $nickGeneratorService, |
| 20 | private NickServiceInterface $nickService, |
| 21 | private SubjectServiceInterface $subjectService, |
| 22 | private QualifierServiceInterface $qualifierService, |
| 23 | private EntityManagerInterface $entityManager, |
| 24 | ) { |
| 25 | } |
| 26 | |
| 27 | public function __invoke(GenerateNickCommand $generateNickCommand): GeneratedNickData |
| 28 | { |
| 29 | $nickGenerationResult = $this->nickGeneratorService->generateNick($generateNickCommand); |
| 30 | |
| 31 | $nick = $nickGenerationResult->getNick(); |
| 32 | |
| 33 | // increment usages count |
| 34 | $this->nickService->incrementUsageCount($nick); |
| 35 | $this->subjectService->incrementUsageCount($nick->getSubject()); |
| 36 | $this->qualifierService->incrementUsageCount($nick->getQualifier()); |
| 37 | |
| 38 | $this->entityManager->flush(); |
| 39 | |
| 40 | return $nickGenerationResult; |
| 41 | } |
| 42 | } |
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.
| 18 | public function __construct( |
| 19 | private NickGeneratorServiceInterface $nickGeneratorService, |
| 20 | private NickServiceInterface $nickService, |
| 21 | private SubjectServiceInterface $subjectService, |
| 22 | private QualifierServiceInterface $qualifierService, |
| 23 | private EntityManagerInterface $entityManager, |
| 24 | ) { |
| 25 | } |
| 27 | public function __invoke(GenerateNickCommand $generateNickCommand): GeneratedNickData |
| 28 | { |
| 29 | $nickGenerationResult = $this->nickGeneratorService->generateNick($generateNickCommand); |
| 30 | |
| 31 | $nick = $nickGenerationResult->getNick(); |
| 32 | |
| 33 | // increment usages count |
| 34 | $this->nickService->incrementUsageCount($nick); |
| 35 | $this->subjectService->incrementUsageCount($nick->getSubject()); |
| 36 | $this->qualifierService->incrementUsageCount($nick->getQualifier()); |
| 37 | |
| 38 | $this->entityManager->flush(); |
| 39 | |
| 40 | return $nickGenerationResult; |
| 41 | } |
| 3 | namespace App\Application\UseCase; |
| 4 | |
| 5 | use App\Dto\Command\GenerateNickCommand; |
| 6 | use App\Dto\Result\GeneratedNickData; |
| 7 | use App\Service\Data\NickServiceInterface; |
| 8 | use App\Service\Data\QualifierServiceInterface; |
| 9 | use App\Service\Data\SubjectServiceInterface; |
| 10 | use App\Service\Generator\NickGeneratorServiceInterface; |
| 11 | use Doctrine\ORM\EntityManagerInterface; |
| 12 | |
| 13 | /** |
| 14 | * @author Wilhelm Zwertvaegher |
| 15 | */ |
| 16 | readonly class GenerateNick implements GenerateNickInterface |
| 17 | { |
| 18 | public function __construct( |
| 19 | private NickGeneratorServiceInterface $nickGeneratorService, |
| 20 | private NickServiceInterface $nickService, |
| 21 | private SubjectServiceInterface $subjectService, |
| 22 | private QualifierServiceInterface $qualifierService, |
| 23 | private EntityManagerInterface $entityManager, |
| 24 | ) { |
| 25 | } |
| 26 | |
| 27 | public function __invoke(GenerateNickCommand $generateNickCommand): GeneratedNickData |
| 28 | { |
| 29 | $nickGenerationResult = $this->nickGeneratorService->generateNick($generateNickCommand); |
| 30 | |
| 31 | $nick = $nickGenerationResult->getNick(); |
| 32 | |
| 33 | // increment usages count |
| 34 | $this->nickService->incrementUsageCount($nick); |
| 35 | $this->subjectService->incrementUsageCount($nick->getSubject()); |
| 36 | $this->qualifierService->incrementUsageCount($nick->getQualifier()); |
| 37 | |
| 38 | $this->entityManager->flush(); |
| 39 | |
| 40 | return $nickGenerationResult; |
| 41 | } |