public static function getClassProperties($class)
    {
        if (is_string($class)) {
            if (isset(self::$classPropertyes[$class])) {
                return self::$classPropertyes[$class];
            }

            $class = new \ReflectionClass($class);
        }

        if (!$class instanceof \ReflectionClass) {
            throw new \InvalidArgumentException('The arguments must be a valid class name or reflection');
        }

        if (isset(self::$classPropertyes[$class->getName()])) {
            return self::$classPropertyes[$class->getName()];
        }

        $props = $class->getProperties();
        $props_arr = [];
        foreach ($props as $prop) {
            $f = $prop->getName();

            $props_arr[$f] = $prop;
        }
        if ($parentClass = $class->getParentClass()) {
            $parent_props_arr = static::getClassProperties($parentClass);//RECURSION
            if (count($parent_props_arr) > 0) {
                $props_arr = array_merge($parent_props_arr, $props_arr);
            }
        }

        self::$classPropertyes[$class->getName()] = $props_arr;

        return $props_arr;
    }
public static function getClassProperties($class)
    {
        if (is_string($class)) {
            if (isset(self::$classPropertyes[$class])) {
                return self::$classPropertyes[$class];
            }

            $class = new \ReflectionClass($class);
        }

        if (!$class instanceof \ReflectionClass) {
            throw new \InvalidArgumentException('The arguments must be a valid class name or reflection');
        }

        if (isset(self::$classPropertyes[$class->getName()])) {
            return self::$classPropertyes[$class->getName()];
        }

        $props = $class->getProperties();
        $props_arr = [];
        foreach ($props as $prop) {
            $f = $prop->getName();

            $props_arr[$f] = $prop;
        }
        if ($parentClass = $class->getParentClass()) {
            $parent_props_arr = static::getClassProperties($parentClass);//RECURSION
            if (count($parent_props_arr) > 0) {
                $props_arr = array_merge($parent_props_arr, $props_arr);
            }
        }

        self::$classPropertyes[$class->getName()] = $props_arr;

        return $props_arr;
    }
public static function getClassProperties ( $ class ) { if ( is_string ( $ class ) ) { if ( isset ( self :: $ classPropertyes [ $ class ] ) ) { return self :: $ classPropertyes [ $ class ] ; } $ class = new \ ReflectionClass ( $ class ) ; } if ( ! $ class instanceof \ ReflectionClass ) { throw new \ InvalidArgumentException ( 'The arguments must be a valid class name or reflection' ) ; } if ( isset ( self :: $ classPropertyes [ $ class -> getName ( ) ] ) ) { return self :: $ classPropertyes [ $ class -> getName ( ) ] ; } $ props = $ class -> getProperties ( ) ; $ props_arr = [ ] ; foreach ( $ props as $ prop ) { $ f = $ prop -> getName ( ) ; $ props_arr [ $ f ] = $ prop ; } if ( $ parentClass = $ class -> getParentClass ( ) ) { $ parent_props_arr = static :: getClassProperties ( $ parentClass ) ; //RECURSION if ( count ( $ parent_props_arr ) > 0 ) { $ props_arr = array_merge ( $ parent_props_arr , $ props_arr ) ; } } self :: $ classPropertyes [ $ class -> getName ( ) ] = $ props_arr ; return $ props_arr ; }
Get array of class properties including parents private properties.

@param \ReflectionClass|string $class

@return array|\ReflectionProperty[]

@throws \ReflectionException
@throws \InvalidArgumentException
Get array of class properties including parents private properties .