| 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 | public function rules(): array |
||
| 12 | { |
||
| 13 | $class = new ReflectionClass($this); |
||
| 14 | $rules = []; |
||
| 15 | |||
| 16 | foreach ($class->getProperties() as $property) { |
||
| 17 | if ($property->isStatic()) { |
||
| 18 | continue; |
||
| 19 | } |
||
| 20 | |||
| 21 | $attributes = $property->getAttributes(Validate::class); |
||
| 22 | foreach ($attributes as $attribute) { |
||
| 23 | $rules[$property->getName()][] = $attribute->newInstance()->getRule(); |
||
| 24 | } |
||
| 25 | } |
||
| 26 | |||
| 27 | return $rules; |
||
| 28 | } |
||
| 30 |