Lines
0.00%
0 / 6
Functions and Methods
0.00%
0 / 6
Classes and Traits
0.00%
0 / 1
| Name | Lines | Functions and Methods | CRAP | Classes and Traits | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| GenerationModel | 0.00% | 0 / 6 | 0.00% | 0 / 6 | 42 | 0.00% | 0 / 1 | |||
| __construct | 0.00% | 0 / 1 | 0.00% | 0 / 1 | 2 | |||||
| listEntityDomains | 0.00% | 0 / 1 | 0.00% | 0 / 1 | 2 | |||||
| listServiceDomains | 0.00% | 0 / 1 | 0.00% | 0 / 1 | 2 | |||||
| countEntities | 0.00% | 0 / 1 | 0.00% | 0 / 1 | 2 | |||||
| countAttributes | 0.00% | 0 / 1 | 0.00% | 0 / 1 | 2 | |||||
| countServices | 0.00% | 0 / 1 | 0.00% | 0 / 1 | 2 | |||||
| 1 | <?php | |
| 2 | ||
| 3 | declare(strict_types=1); | |
| 4 | ||
| 5 | namespace Stewart\Codegen\Model; | |
| 6 | ||
| 7 | use Stewart\Codegen\Model\Collection\DomainModelCollection; | |
| 8 | use Stewart\Contracts\Entity\Collection\EntityIdCollection; | |
| 9 | use Stewart\Contracts\Registry\Collection\AreaIdCollection; | |
| 10 | use Stewart\Contracts\Registry\Collection\FloorIdCollection; | |
| 11 | use Stewart\Contracts\Registry\Collection\LabelIdCollection; | |
| 12 | ||
| 13 | final readonly class GenerationModel | |
| 14 | { | |
| 15 | /** @param list<GenerationWarning> $warnings */ | |
| 16 | public function __construct( | |
| 17 | public DomainModelCollection $domains, | |
| 18 | public EntityIdCollection $entityIds, | |
| 19 | public EntityIdCollection $ignoredEntityIds, | |
| 20 | public array $warnings, | |
| 21 | public AreaIdCollection $areaIds, | |
| 22 | public FloorIdCollection $floorIds, | |
| 23 | public LabelIdCollection $labelIds, | |
| 24 | ) {} | |
| 25 | ||
| 26 | public function listEntityDomains(): DomainModelCollection | |
| 27 | { | |
| 28 | return $this->domains->havingEntities(); | |
| 29 | } | |
| 30 | ||
| 31 | public function listServiceDomains(): DomainModelCollection | |
| 32 | { | |
| 33 | return $this->domains->havingServices(); | |
| 34 | } | |
| 35 | ||
| 36 | public function countEntities(): int | |
| 37 | { | |
| 38 | return \count($this->entityIds); | |
| 39 | } | |
| 40 | ||
| 41 | public function countAttributes(): int | |
| 42 | { | |
| 43 | return $this->listEntityDomains()->countAttributes(); | |
| 44 | } | |
| 45 | ||
| 46 | public function countServices(): int | |
| 47 | { | |
| 48 | return array_sum($this->domains->mapToList(static fn(DomainModel $domain): int => \count($domain->services))); | |
| 49 | } | |
| 50 | } |