Conditions | 3 |
Paths | 3 |
Total Lines | 17 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Tests | 8 |
CRAP Score | 3 |
Changes | 0 |
1 | <?php |
||
40 | 24 | private function byClass(string $class, string $property): \ReflectionProperty |
|
41 | { |
||
42 | 24 | $refl = new \ReflectionClass($class); |
|
43 | |||
44 | 24 | if ($refl->hasProperty($property)) { |
|
45 | 8 | return $refl->getProperty($property); |
|
46 | } |
||
47 | |||
48 | 24 | if ($refl->getParentClass()) { |
|
49 | 8 | return $this->byClass( |
|
50 | 8 | $refl->getParentClass()->getName(), |
|
51 | $property |
||
52 | ); |
||
53 | } |
||
54 | |||
55 | 16 | throw new PropertyNotFoundException; |
|
56 | } |
||
57 | } |
||
58 |