src/UniversalJsonSerializer.php
private static function objectProperties($object): array
    {
        if ($object instanceof Serializable) {
            return ['$' => $object->serialize()];
        }

        $class = get_class($object);
        $properties = [];

        do {
            try {
                $properties += Closure::bind(function () use ($object) {
                    return get_object_vars($object);
                }, null, $class)->__invoke();
            } catch (Throwable $e) {
                return get_object_vars($object);
            }
        } while ($class = get_parent_class($class));

        return method_exists($object, '__sleep')
            ? array_intersect_key($properties, array_flip($object->__sleep()))
            : $properties;
    }
private static function objectProperties($object): array
    {
        if ($object instanceof Serializable) {
            return ['$' => $object->serialize()];
        }

        $class = get_class($object);
        $properties = [];

        do {
            try {
                $properties += Closure::bind(function () use ($object) {
                    return get_object_vars($object);
                }, null, $class)->__invoke();
            } catch (Throwable $e) {
                return get_object_vars($object);
            }
        } while ($class = get_parent_class($class));

        return method_exists($object, '__sleep')
            ? array_intersect_key($properties, array_flip($object->__sleep()))
            : $properties;
    }
private static function objectProperties ( $ object ) : array { if ( $ object instanceof Serializable ) { return [ '$' => $ object -> serialize ( ) ] ; } $ class = get_class ( $ object ) ; $ properties = [ ] ; do { try { $ properties += Closure :: bind ( function ( ) use ( $ object ) { return get_object_vars ( $ object ) ; } , null , $ class ) -> __invoke ( ) ; } catch ( Throwable $ e ) { return get_object_vars ( $ object ) ; } } while ( $ class = get_parent_class ( $ class ) ) ; return method_exists ( $ object , '__sleep' ) ? array_intersect_key ( $ properties , array_flip ( $ object -> __sleep ( ) ) ) : $ properties ; }
Get array of all the object properties.

@param object $object

@return mixed[] The array of all the object properties.
Get array of all the object properties .