BetterReflection\Reflection\ReflectionClass::getStaticPropertyValue PHP Method

getStaticPropertyValue() public method

(note, differs very slightly from internal reflection behaviour)
public getStaticPropertyValue ( string $propertyName ) : mixed
$propertyName string
return mixed
    public function getStaticPropertyValue($propertyName)
    {
        if (!class_exists($this->getName(), false)) {
            throw new Exception\ClassDoesNotExist('Property cannot be retrieved as the class is not loaded');
        }
        if (!$this->hasProperty($propertyName) || !$this->getProperty($propertyName)->isStatic()) {
            throw new Exception\PropertyDoesNotExist('Property does not exist on class or is not static');
        }
        // PHP behaviour is to simply say "property does not exist" if accessing
        // protected or private values. Here we be a little more explicit in
        // reasoning...
        if (!$this->getProperty($propertyName)->isPublic()) {
            throw new Exception\PropertyNotPublic('Property is not public');
        }
        $className = $this->getName();
        return $className::${$propertyName};
    }