| Conditions | 4 |
| Paths | 4 |
| Total Lines | 27 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 20 |
| Changes | 0 | ||
| 1 | <?php |
||
| 49 | protected function getClassConfig($class) |
||
| 50 | { |
||
| 51 | // Autoload the class if it exists |
||
| 52 | if(!class_exists($class)) { |
||
| 53 | return []; |
||
| 54 | } |
||
| 55 | |||
| 56 | /** @var \ReflectionProperty[] **/ |
||
| 57 | $props = (new ReflectionClass($class)) |
||
| 58 | ->getStaticProperties(); |
||
| 59 | |||
| 60 | $classConfig = []; |
||
| 61 | |||
| 62 | // Loop through each static property and add all private statics to the |
||
| 63 | // class config |
||
| 64 | foreach($props as $prop) { |
||
| 65 | // We don't want non-private statics |
||
| 66 | if(!$prop->isPrivate()) { |
||
| 67 | continue; |
||
| 68 | } |
||
| 69 | |||
| 70 | $prop->setAccessible(true); |
||
| 71 | $classConfig[$prop->getName()] = $prop->getValue(); |
||
| 72 | } |
||
| 73 | |||
| 74 | return $classConfig; |
||
| 75 | } |
||
| 76 | |||
| 78 |
This check marks access to variables or properties that have not been declared yet. While PHP has no explicit notion of declaring a variable, accessing it before a value is assigned to it is most likely a bug.