Kraken\Test\TUnit::getProtectedProperty PHP Method

getProtectedProperty() public method

Get protected property from given object via reflection.
public getProtectedProperty ( object $object, string $property ) : mixed
$object object
$property string
return mixed
    public function getProtectedProperty($object, $property)
    {
        $reflection = new ReflectionClass($object);
        $reflection_property = $reflection->getProperty($property);
        $reflection_property->setAccessible(true);
        return $reflection_property->getValue($object);
    }