Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
66.67% |
4 / 6 |
|
80.00% |
4 / 5 |
CRAP | |
0.00% |
0 / 1 |
| ResourceDefinition | |
66.67% |
4 / 6 |
|
80.00% |
4 / 5 |
5.93 | |
0.00% |
0 / 1 |
| __construct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getName | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| addPropertyDefinition | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 | |||
| getProperties | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getId | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | namespace Apie\Maker\BoundedContext\Resources; |
| 3 | |
| 4 | use Apie\Core\Attributes\HideIdOnOverview; |
| 5 | use Apie\Core\Attributes\Not; |
| 6 | use Apie\Core\Attributes\RemovalCheck; |
| 7 | use Apie\Core\Attributes\Requires; |
| 8 | use Apie\Core\Attributes\RuntimeCheck; |
| 9 | use Apie\Core\Attributes\StaticCheck; |
| 10 | use Apie\Core\ContextConstants; |
| 11 | use Apie\Core\Entities\EntityInterface; |
| 12 | use Apie\Core\Identifiers\PascalCaseSlug; |
| 13 | use Apie\Maker\BoundedContext\Dtos\PropertyDefinition; |
| 14 | use Apie\Maker\BoundedContext\Identifiers\BoundedContextDefinitionIdentifier; |
| 15 | use Apie\Maker\BoundedContext\Identifiers\ResourceDefinitionIdentifier; |
| 16 | use Apie\Maker\BoundedContext\Lists\PropertyDefinitionList; |
| 17 | use Apie\Maker\Enums\IdType; |
| 18 | |
| 19 | #[HideIdOnOverview] |
| 20 | #[RemovalCheck(new StaticCheck())] |
| 21 | class ResourceDefinition implements EntityInterface |
| 22 | { |
| 23 | public function __construct( |
| 24 | private ResourceDefinitionIdentifier $id, |
| 25 | #[RuntimeCheck(new Not(new Requires(ContextConstants::GET_ALL_OBJECTS)))] |
| 26 | public IdType $idType, |
| 27 | private PascalCaseSlug $name, |
| 28 | public BoundedContextDefinitionIdentifier $boundedContextId, |
| 29 | #[RuntimeCheck(new Not(new Requires(ContextConstants::GET_ALL_OBJECTS)))] |
| 30 | private PropertyDefinitionList $properties |
| 31 | ) { |
| 32 | } |
| 33 | |
| 34 | public function getName(): PascalCaseSlug |
| 35 | { |
| 36 | return $this->name; |
| 37 | } |
| 38 | |
| 39 | public function addPropertyDefinition(PropertyDefinition $propertyDefinition): self |
| 40 | { |
| 41 | $this->properties->append($propertyDefinition); |
| 42 | return $this; |
| 43 | } |
| 44 | |
| 45 | public function getProperties(): PropertyDefinitionList |
| 46 | { |
| 47 | return $this->properties; |
| 48 | } |
| 49 | |
| 50 | public function getId(): ResourceDefinitionIdentifier |
| 51 | { |
| 52 | return $this->id; |
| 53 | } |
| 54 | } |