Lines
0.00%
0 / 9
Functions and Methods
0.00%
0 / 9
Classes and Traits
0.00%
0 / 1
| Name | Lines | Functions and Methods | CRAP | Classes and Traits | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| DomainModel | 0.00% | 0 / 9 | 0.00% | 0 / 9 | 90 | 0.00% | 0 / 1 | |||
| __construct | 0.00% | 0 / 1 | 0.00% | 0 / 1 | 2 | |||||
| getEntitiesClass | 0.00% | 0 / 1 | 0.00% | 0 / 1 | 2 | |||||
| getHandleClass | 0.00% | 0 / 1 | 0.00% | 0 / 1 | 2 | |||||
| getStateClass | 0.00% | 0 / 1 | 0.00% | 0 / 1 | 2 | |||||
| getServicesClass | 0.00% | 0 / 1 | 0.00% | 0 / 1 | 2 | |||||
| isOnOff | 0.00% | 0 / 1 | 0.00% | 0 / 1 | 2 | |||||
| isNumeric | 0.00% | 0 / 1 | 0.00% | 0 / 1 | 2 | |||||
| hasEntities | 0.00% | 0 / 1 | 0.00% | 0 / 1 | 2 | |||||
| hasServices | 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\Attribute\AttributeModel; | |
| 8 | use Stewart\Codegen\Service\ServiceModel; | |
| 9 | use Stewart\Contracts\Entity\Collection\EntityIdCollection; | |
| 10 | ||
| 11 | final readonly class DomainModel | |
| 12 | { | |
| 13 | /** | |
| 14 | * @param list<AttributeModel> $attributes | |
| 15 | * @param list<ServiceModel> $handleServices | |
| 16 | * @param list<ServiceModel> $services | |
| 17 | */ | |
| 18 | public function __construct( | |
| 19 | public string $domain, | |
| 20 | public string $accessor, | |
| 21 | public string $classStem, | |
| 22 | public DomainTraits $traits, | |
| 23 | public EntityIdCollection $entityIds, | |
| 24 | public array $attributes, | |
| 25 | public array $handleServices, | |
| 26 | public array $services, | |
| 27 | ) {} | |
| 28 | ||
| 29 | public function getEntitiesClass(): string | |
| 30 | { | |
| 31 | return $this->classStem . 'Entities'; | |
| 32 | } | |
| 33 | ||
| 34 | public function getHandleClass(): string | |
| 35 | { | |
| 36 | return $this->classStem . 'Entity'; | |
| 37 | } | |
| 38 | ||
| 39 | public function getStateClass(): string | |
| 40 | { | |
| 41 | return $this->classStem . 'State'; | |
| 42 | } | |
| 43 | ||
| 44 | public function getServicesClass(): string | |
| 45 | { | |
| 46 | return $this->classStem . 'Services'; | |
| 47 | } | |
| 48 | ||
| 49 | public function isOnOff(): bool | |
| 50 | { | |
| 51 | return $this->traits->onOff; | |
| 52 | } | |
| 53 | ||
| 54 | public function isNumeric(): bool | |
| 55 | { | |
| 56 | return $this->traits->numeric; | |
| 57 | } | |
| 58 | ||
| 59 | public function hasEntities(): bool | |
| 60 | { | |
| 61 | return !$this->entityIds->isEmpty(); | |
| 62 | } | |
| 63 | ||
| 64 | public function hasServices(): bool | |
| 65 | { | |
| 66 | return $this->services !== []; | |
| 67 | } | |
| 68 | } |