| Conditions | 4 |
| Paths | 4 |
| Total Lines | 17 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 20 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 11 | use Yiisoft\Validator\Rule\Each; |
||
| 12 | use Yiisoft\Validator\Rule\Nested; |
||
| 13 | |||
| 14 | trait AttributeTrait |
||
| 15 | { |
||
| 16 | public function getRule(): Rule |
||
| 17 | { |
||
| 18 | $class = new ReflectionClass($this); |
||
| 19 | |||
| 20 | return $this->handleClass($class); |
||
| 21 | } |
||
| 22 | |||
| 23 | private function handleClass(ReflectionClass $class): Rule |
||
| 24 | { |
||
| 25 | $rules = []; |
||
| 26 | foreach ($class->getProperties() as $property) { |
||
| 27 | if ($property->isStatic()) { |
||
| 28 | continue; |
||
| 71 |