| Total Complexity | 6 |
| Total Lines | 42 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 15 | final class ObjectWithDataSetAndRulesProvider implements DataSetInterface, RulesProviderInterface |
||
| 16 | { |
||
| 17 | #[Required] |
||
| 18 | public string $name = ''; |
||
| 19 | |||
| 20 | #[Number(min: 21)] |
||
| 21 | protected int $key1 = 17; |
||
| 22 | |||
| 23 | #[Number(max: 100)] |
||
| 24 | private int $key2 = 42; |
||
|
|
|||
| 25 | |||
| 26 | public function getRules(): iterable |
||
| 27 | { |
||
| 28 | return [ |
||
| 29 | 'key1' => [new Required()], |
||
| 30 | 'key2' => [new Required(), new Equal(99)], |
||
| 31 | ]; |
||
| 32 | } |
||
| 33 | |||
| 34 | public function getAttributeValue(string $attribute): mixed |
||
| 35 | { |
||
| 36 | return $this->getObjectData()[$attribute] ?? null; |
||
| 37 | } |
||
| 38 | |||
| 39 | public function getData(): ?array |
||
| 42 | } |
||
| 43 | |||
| 44 | public function getSource(): self |
||
| 47 | } |
||
| 48 | |||
| 49 | public function hasAttribute(string $attribute): bool |
||
| 52 | } |
||
| 53 | |||
| 54 | private function getObjectData(): array |
||
| 59 |