Conditions | 3 |
Paths | 3 |
Total Lines | 16 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Tests | 9 |
CRAP Score | 3 |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
36 | 12 | private function byClass(string $class, string $property): \ReflectionProperty |
|
37 | { |
||
38 | 12 | $refl = new \ReflectionClass($class); |
|
39 | |||
40 | 12 | if ($refl->hasProperty($property)) { |
|
41 | 4 | return $refl->getProperty($property); |
|
42 | } |
||
43 | |||
44 | 12 | if ($refl->getParentClass()) { |
|
45 | 4 | return $this->byClass( |
|
46 | 4 | $refl->getParentClass()->getName(), |
|
47 | 4 | $property, |
|
48 | ); |
||
49 | } |
||
50 | |||
51 | 8 | throw new PropertyNotFound($property); |
|
52 | } |
||
54 |