src/Utilities/Reflection.php
public static function getProperties($source, $filter = null, $includeParents = false): array
    {
        $className = self::getClassName($source);
        $reflection = new \ReflectionClass($className);

        if (null === $filter) {
            $filter = \ReflectionProperty::IS_PRIVATE
                + \ReflectionProperty::IS_PROTECTED
                + \ReflectionProperty::IS_PUBLIC
                + \ReflectionProperty::IS_STATIC;
        }

        $properties = $reflection->getProperties($filter);
        $parentProperties = [];

        if ($includeParents) {
            $parent = self::getParentClass($source);

            if (false !== $parent) {
                $parentClass = $parent->getName();
                $parentProperties = self::getProperties($parentClass, $filter, $includeParents);
            }
        }

        return array_merge($properties, $parentProperties);
    }
public static function getProperties($source, $filter = null, $includeParents = false): array
    {
        $className = self::getClassName($source);
        $reflection = new \ReflectionClass($className);

        if (null === $filter) {
            $filter = \ReflectionProperty::IS_PRIVATE
                + \ReflectionProperty::IS_PROTECTED
                + \ReflectionProperty::IS_PUBLIC
                + \ReflectionProperty::IS_STATIC;
        }

        $properties = $reflection->getProperties($filter);
        $parentProperties = [];

        if ($includeParents) {
            $parent = self::getParentClass($source);

            if (false !== $parent) {
                $parentClass = $parent->getName();
                $parentProperties = self::getProperties($parentClass, $filter, $includeParents);
            }
        }

        return array_merge($properties, $parentProperties);
    }
public static function getProperties ( $ source , $ filter = null , $ includeParents = false ) : array { $ className = self :: getClassName ( $ source ) ; $ reflection = new \ ReflectionClass ( $ className ) ; if ( null === $ filter ) { $ filter = \ ReflectionProperty :: IS_PRIVATE + \ ReflectionProperty :: IS_PROTECTED + \ ReflectionProperty :: IS_PUBLIC + \ ReflectionProperty :: IS_STATIC ; } $ properties = $ reflection -> getProperties ( $ filter ) ; $ parentProperties = [ ] ; if ( $ includeParents ) { $ parent = self :: getParentClass ( $ source ) ; if ( false !== $ parent ) { $ parentClass = $ parent -> getName ( ) ; $ parentProperties = self :: getProperties ( $ parentClass , $ filter , $ includeParents ) ; } } return array_merge ( $ properties , $ parentProperties ) ; }
Returns given object properties

@param array|object|string $source         An array of objects, namespaces, object or namespace
@param int                 $filter         (optional) Filter of properties. Uses \ReflectionProperty class
constants. By default all properties are returned.
@param bool                $includeParents (optional) If is set to true, properties of parent classes are
included (recursively). Otherwise - not.
@return \ReflectionProperty[]
Returns given object properties