public static function getProperties($objectOrClass)
    {
        $class = $objectOrClass;
        if (!is_string($objectOrClass)) {
            Assert::object($objectOrClass, 'Can not get a property of a non object. Variable of type "%s" was given.');
            Assert::notInstanceOf($objectOrClass, '\stdClass', 'Can not get a property of \stdClass.');
            $class = get_class($objectOrClass);
        }

        $refl = new \ReflectionClass($class);
        $properties = $refl->getProperties();

        // check parents
        while (false !== $parent = get_parent_class($class)) {
            $parentRefl = new \ReflectionClass($parent);
            $properties = array_merge($properties, $parentRefl->getProperties());
            $class = $parent;
        }

        return array_map(function($reflectionProperty) {
            return $reflectionProperty->name;
        }, $properties);
    }
public static function getProperties($objectOrClass)
    {
        $class = $objectOrClass;
        if (!is_string($objectOrClass)) {
            Assert::object($objectOrClass, 'Can not get a property of a non object. Variable of type "%s" was given.');
            Assert::notInstanceOf($objectOrClass, '\stdClass', 'Can not get a property of \stdClass.');
            $class = get_class($objectOrClass);
        }

        $refl = new \ReflectionClass($class);
        $properties = $refl->getProperties();

        // check parents
        while (false !== $parent = get_parent_class($class)) {
            $parentRefl = new \ReflectionClass($parent);
            $properties = array_merge($properties, $parentRefl->getProperties());
            $class = $parent;
        }

        return array_map(function($reflectionProperty) {
            return $reflectionProperty->name;
        }, $properties);
    }
public static function getProperties ( $ objectOrClass ) { $ class = $ objectOrClass ; if ( ! is_string ( $ objectOrClass ) ) { Assert :: object ( $ objectOrClass , 'Can not get a property of a non object. Variable of type "%s" was given.' ) ; Assert :: notInstanceOf ( $ objectOrClass , '\stdClass' , 'Can not get a property of \stdClass.' ) ; $ class = get_class ( $ objectOrClass ) ; } $ refl = new \ ReflectionClass ( $ class ) ; $ properties = $ refl -> getProperties ( ) ; // check parents while ( false !== $ parent = get_parent_class ( $ class ) ) { $ parentRefl = new \ ReflectionClass ( $ parent ) ; $ properties = array_merge ( $ properties , $ parentRefl -> getProperties ( ) ) ; $ class = $ parent ; } return array_map ( function ( $ reflectionProperty ) { return $ reflectionProperty -> name ; } , $ properties ) ; }
Get all property names on a class or object

@param object|string $objectOrClass

@return array of strings

@throws \InvalidArgumentException
Get all property names on a class or object