protected static function getObjectClassName($object)
    {
        $nameGetters = [
            \ReflectionClass::class => 'getName()',
            \ReflectionMethod::class => 'class',
            \ReflectionProperty::class => 'class',
        ];
        foreach ($nameGetters as $class => $getter) {
            if ($object instanceof $class) {
                $isMethod = substr($getter, -2) === '()';
                if ($isMethod) {
                    $getter = substr($getter, 0, -2);
                    return call_user_func([$object, $getter]);
                }
                return $object->$getter;
            }
        }
        return get_class($object);
    }
protected static function getObjectClassName($object)
    {
        $nameGetters = [
            \ReflectionClass::class => 'getName()',
            \ReflectionMethod::class => 'class',
            \ReflectionProperty::class => 'class',
        ];
        foreach ($nameGetters as $class => $getter) {
            if ($object instanceof $class) {
                $isMethod = substr($getter, -2) === '()';
                if ($isMethod) {
                    $getter = substr($getter, 0, -2);
                    return call_user_func([$object, $getter]);
                }
                return $object->$getter;
            }
        }
        return get_class($object);
    }
protected static function getObjectClassName ( $ object ) { $ nameGetters = [ \ ReflectionClass :: class => 'getName()' , \ ReflectionMethod :: class => 'class' , \ ReflectionProperty :: class => 'class' , ] ; foreach ( $ nameGetters as $ class => $ getter ) { if ( $ object instanceof $ class ) { $ isMethod = substr ( $ getter , - 2 ) === '()' ; if ( $ isMethod ) { $ getter = substr ( $ getter , 0 , - 2 ) ; return call_user_func ( [ $ object , $ getter ] ) ; } return $ object -> $ getter ; } } return get_class ( $ object ) ; }
Get class name of object or its reflection
@param object $object
@return mixed|string
Get class name of object or its reflection