protected static function accessProtectedProperty($object, $propertyName)
    {
        $className = get_class($object);
        if (!isset(static::$reflectedClasses[$className])) {
            static::$reflectedClasses[$className] = new \ReflectionClass($className);
        }
        $class = static::$reflectedClasses[$className];
        $property = $class->getProperty($propertyName);
        $property->setAccessible(true);

        return $property->getValue($object);
    }
protected static function accessProtectedProperty($object, $propertyName)
    {
        $className = get_class($object);
        if (!isset(static::$reflectedClasses[$className])) {
            static::$reflectedClasses[$className] = new \ReflectionClass($className);
        }
        $class = static::$reflectedClasses[$className];
        $property = $class->getProperty($propertyName);
        $property->setAccessible(true);

        return $property->getValue($object);
    }
Returns the value of a protected property.

@param object $object
@param string $propertyName
@return mixed