public static function callMethod(
        string $name,
        ?object $object,
        array $arguments = [],
        ?string $classOverride = null
    ) {
        $method = self::getReflectionMethod($name, $object, $classOverride);
        $method->setAccessible(true);
        if (count($arguments) > 0) {
            return $method->invokeArgs($object, $arguments);
        }
        return $method->invoke($object);
    }
public static function callMethod(
        string $name,
        ?object $object,
        array $arguments = [],
        ?string $classOverride = null
    ) {
        $method = self::getReflectionMethod($name, $object, $classOverride);
        $method->setAccessible(true);
        if (count($arguments) > 0) {
            return $method->invokeArgs($object, $arguments);
        }
        return $method->invoke($object);
    }
public static function callMethod ( string $ name , ? object $ object , array $ arguments = [ ] , ? string $ classOverride = null ) { $ method = self :: getReflectionMethod ( $ name , $ object , $ classOverride ) ; $ method -> setAccessible ( true ) ; if ( count ( $ arguments ) > 0 ) { return $ method -> invokeArgs ( $ object , $ arguments ) ; } return $ method -> invoke ( $ object ) ; }
Call method.

@param string $name
@param object $object
@param string[] $arguments Default [].
@param string $classOverride Default null.
@return mixed
@throws \ReflectionException
Call method .