Lines
100.00%
3 / 3
Functions and Methods
100.00%
2 / 2
Classes and Traits
100.00%
1 / 1
| Name | Lines | Functions and Methods | CRAP | Classes and Traits | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| GenerationOptions | 100.00% | 3 / 3 | 100.00% | 2 / 2 | 2 | 100.00% | 1 / 1 | |||
| __construct | 100.00% | 2 / 2 | 100.00% | 1 / 1 | 1 | |||||
| attributesFor | 100.00% | 1 / 1 | 100.00% | 1 / 1 | 1 | |||||
| 1 | <?php | |
| 2 | ||
| 3 | declare(strict_types=1); | |
| 4 | ||
| 5 | namespace Stewart\Codegen; | |
| 6 | ||
| 7 | use Stewart\Codegen\Attribute\AttributeFilter; | |
| 8 | use Stewart\Codegen\Attribute\Collection\AttributeFilterCollection; | |
| 9 | use Stewart\Codegen\Entity\EntityInclusionRules; | |
| 10 | ||
| 11 | final readonly class GenerationOptions | |
| 12 | { | |
| 13 | public EntityInclusionRules $inclusionRules; | |
| 14 | ||
| 15 | private AttributeFilterCollection $attributes; | |
| 16 | ||
| 17 | public function __construct( | |
| 18 | ?EntityInclusionRules $inclusionRules = null, | |
| 19 | ?AttributeFilterCollection $attributes = null, | |
| 20 | ) { | |
| 21 | $this->inclusionRules = $inclusionRules ?? EntityInclusionRules::allowingEverything(); | |
| 22 | $this->attributes = $attributes ?? AttributeFilterCollection::empty(); | |
| 23 | } | |
| 24 | ||
| 25 | public function attributesFor(string $domain): AttributeFilter | |
| 26 | { | |
| 27 | return $this->attributes->find($domain) ?? new AttributeFilter($domain); | |
| 28 | } | |
| 29 | } |