public static function readPrivateProperty($object, $property, $class = null)
    {
        if (is_null($class)) {
            $class = $object;
        }

        $property = new \ReflectionProperty($class, $property);
        $property->setAccessible(true);

        return $property->getValue($object);
    }
public static function readPrivateProperty($object, $property, $class = null)
    {
        if (is_null($class)) {
            $class = $object;
        }

        $property = new \ReflectionProperty($class, $property);
        $property->setAccessible(true);

        return $property->getValue($object);
    }
public static function readPrivateProperty ( $ object , $ property , $ class = null ) { if ( is_null ( $ class ) ) { $ class = $ object ; } $ property = new \ ReflectionProperty ( $ class , $ property ) ; $ property -> setAccessible ( true ) ; return $ property -> getValue ( $ object ) ; }
Read a private property of an object.

@param object $object
@param string $property
@param string|null $class
@return mixed
Read a private property of an object .