Total Complexity | 5 |
Total Lines | 34 |
Duplicated Lines | 0 % |
Coverage | 0% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
18 | #[Attribute(Attribute::TARGET_PROPERTY | Attribute::IS_REPEATABLE)] |
||
19 | final class Embedded extends Composite |
||
20 | { |
||
21 | /** |
||
22 | * @psalm-param Closure(mixed, ValidationContext):bool|null $when |
||
23 | */ |
||
24 | public function __construct( |
||
25 | private string $referenceClassName, |
||
26 | bool $skipOnEmpty = false, |
||
27 | bool $skipOnError = false, |
||
28 | ?Closure $when = null, |
||
29 | ) { |
||
30 | parent::__construct([], $skipOnEmpty, $skipOnError, $when); |
||
31 | } |
||
32 | |||
33 | public function getRules(): array |
||
34 | { |
||
35 | $classMeta = new ReflectionClass($this->referenceClassName); |
||
36 | |||
37 | return $this->collectAttributes($classMeta); |
||
38 | } |
||
39 | |||
40 | // TODO: use Generator to collect attributes |
||
41 | private function collectAttributes(ReflectionClass $classMeta): array |
||
52 | } |
||
53 | } |
||
54 |