src/Encoder/ObjectEncoder.php
private function getObjectState($object)
    {
        $class = new \ReflectionClass($object);
        $visibility = \ReflectionProperty::IS_PRIVATE | \ReflectionProperty::IS_PROTECTED;
        $values = [];

        do {
            foreach ($class->getProperties($visibility) as $property) {
                $property->setAccessible(true);
                $values[$property->getName()] = $property->getValue($object);
            }

            $class = $class->getParentClass();
            $visibility = \ReflectionProperty::IS_PRIVATE;
        } while ($class);

        return get_object_vars($object) + $values;
    }
private function getObjectState($object)
    {
        $class = new \ReflectionClass($object);
        $visibility = \ReflectionProperty::IS_PRIVATE | \ReflectionProperty::IS_PROTECTED;
        $values = [];

        do {
            foreach ($class->getProperties($visibility) as $property) {
                $property->setAccessible(true);
                $values[$property->getName()] = $property->getValue($object);
            }

            $class = $class->getParentClass();
            $visibility = \ReflectionProperty::IS_PRIVATE;
        } while ($class);

        return get_object_vars($object) + $values;
    }
private function getObjectState ( $ object ) { $ class = new \ ReflectionClass ( $ object ) ; $ visibility = \ ReflectionProperty :: IS_PRIVATE | \ ReflectionProperty :: IS_PROTECTED ; $ values = [ ] ; do { foreach ( $ class -> getProperties ( $ visibility ) as $ property ) { $ property -> setAccessible ( true ) ; $ values [ $ property -> getName ( ) ] = $ property -> getValue ( $ object ) ; } $ class = $ class -> getParentClass ( ) ; $ visibility = \ ReflectionProperty :: IS_PRIVATE ; } while ( $ class ) ; return get_object_vars ( $ object ) + $ values ; }
Returns an array of object properties as would be generated by var_export.
@param object $object Object to turn into array
@return array Properties of the object as passed to var_export
Returns an array of object properties as would be generated by var_export .