Adds method to array of methods accepted by Route

@param   string  $method     Name of HTTP method to add
@return  Route
@throws  InvalidArgumentException
974150
public function addMethod($method)
    {
        // Capitalise method
        $method = strtoupper($method);

        if (!in_array($method, self::$availableMethods)) {
            throw new InvalidArgumentException(sprintf('Invalid method for route with path "%s". Method must be one of: ' . implode(', ', self::$availableMethods) . '. Got "%s" instead.', $this->getPath(), $method));
        }

        if (!in_array($method, $this->methods)) {
            $this->methods[] = $method;
        }

        // Add HEAD method if GET has been allowed for this Route
        if ($method == 'GET') {
            $this->addMethod('HEAD');
        }

        return $this;
    }
960734
public function add($method)
    {
        if (!$method instanceof MethodInterface) {
            throw new \InvalidArgumentException('This Method must be a instance of \ClassGeneration\MethodInterface');
        }
        if ($method->getName() === null) {
            $method->setName('method' . ($this->count() + 1));
        }

        parent::set($method->getName(), $method);
        return true;
    }
278322
protected static function filterMethod($method)
    {
        if (! is_string($method)) {
            throw new InvalidArgumentException(sprintf(
                'Invalid HTTP method; must be a string, received %s',
                (is_object($method) ? get_class($method) : gettype($method))
            ));
        }

        if (! preg_match("/^[!#$%&'*+.^_`|~0-9a-z-]+$/i", $method)) {
            throw new InvalidArgumentException(sprintf(
                'Unsupported HTTP method "%s" provided',
                $method
            ));
        }

        return strtoupper($method);
    }
1111462
public function addRoute(array $methods, string $route, $handler): void
    {
        if ($methods === []) {
            throw new \InvalidArgumentException('Methods is empty');
        }

        if (\is_callable($handler)) {
            $handler = \Closure::fromCallable($handler);
        } elseif (!\is_array($handler)) {
            throw new \InvalidArgumentException('Handler is not a valid type: ' . \var_export($handler, true));
        }

        $parts = \explode('/', \trim($route, static::SEPARATOR_TRIM));

        if (!isset($parts[1]) && $parts[0] === '') {
            $parts = [];
        }

        $current = &$this->routes;
        foreach ($parts as $v) {
            if ($v[0] === '{' && $v[-1] === '}') {
                $v = \substr($v, 1, -1);
                if (\strpos($v, ':') !== false) {
                    [$name, $regexp] = \explode(':', $v, 2);

                    $regexp = '/^' . $regexp . '$/';
                    if (!isset($current['regexps'][$regexp])) {
                        $current['regexps'][$regexp] = [
                            'children' => [],
                            'regexps' => [],
                            'name' => $name,
                        ];
                    }
                    $current = &$current['regexps'][$regexp];
                } else {
                    if (!isset($current['others'])) {
                        $current['others'] = [
                            'children' => [],
                            'regexps' => [],
                            'name' => $v,
                        ];
                    }
                    $current = &$current['others'];
                }
            } else {
                if (!isset($current['children'][$v])) {
                    $current['children'][$v] = [
                        'children' => [],
                        'regexps' => [],
                    ];
                }
                $current = &$current['children'][$v];
            }
        }

        $current['route'] = $route;

        if (!isset($current['methods'])) {
            $current['methods'] = [];
        }

        foreach ($methods as $v) {
            $current['methods'][\strtoupper($v)] = $handler;
        }
    }
204378
public function createRequest($method, $uri){
        if(!is_string($method)){
            throw new \InvalidArgumentException();
        }else if(!is_string($uri) && !($uri instanceof UriInterface)){
            throw new \InvalidArgumentException();
        }

        if(is_string($uri)){
            $uri    = new Uri($uri);
        }

        return new Request($method, $uri);
    }
1127867
protected function validateMethod($method)
    {
        if (null === $method) {
            return;
        }

        if (!is_string($method)) {
            throw new InvalidArgumentException('HTTP method must be a string.');
        }

        if (!preg_match('/^[!#$%&\'*+.^_`\|~0-9a-z-]+$/i', $method)) {
            throw new InvalidArgumentException(sprintf('Invalid HTTP method "%s"', $method));
        }
    }
166282
public function addMethod($method, callable $callback)
    {
        if (!is_string($method)) {
            throw new \InvalidArgumentException('$method must be string');
        }
        $this->plugins[$method] = $callback;
    }
489227
public function add($method, $pattern): RouteInterface
    {
        $route = new Route($this, $method);
        $route->setContainer($this->container);
        if (null !== $this->actionClass) {
            $route->setActionClass($this->actionClass);
        }
        if (null !== $this->requestClass) {
            $route->setRequestClass($this->requestClass);
        }
        $route->setPackage($this->getPackage());
        $prefixes = [$this->resourceName];
        if ($this->isSubResourceOfPackage()) {
            # Add package before resource
            array_unshift($prefixes, $this->packageName);
        }
        if ($this->routesPrefix) {
            # Add prefix before resource
            array_unshift($prefixes, $this->routesPrefix);
        }
        $pattern = $this->trailingSlash($pattern);
        $pattern = implode('/', $prefixes) . $pattern;
        $pattern = '/' . ltrim($pattern, '/');
        $route->setPattern($pattern);

        $this->data[] = $route;

        return $route;
    }
829210
public function addRoute($method, $path, $action)
    {
        $route = (new Route($this->conditions, $this->container))
            ->setMethods($method)
            ->setPath($path)
            ->setAction($action)
            ->setRouter($this);

        return $this->routes->add($route);
    }
181085
private function add(string $method, string $route, callable $callable)
	{
		$entry = (object)[
			'route' => $route,
			'pattern' => $this->createPattern($route),
			'callable' => $callable
		];

		if (!array_key_exists($method, $this->routes)) {
			$this->routes[$method] = [];
		}

		$this->routes[$method][] = $entry;
	}
750923
public function addRoute($name, $pattern = null, $variables = [], $method = [], $options = [])
    {
        if ($name instanceof Route) {
            $route = $name;
        } else {
            if (!is_string($pattern)) {
                throw new \InvalidArgumentException('Route pattern should be string');
            }

            $route = new Route($name, $pattern, $variables, $method, $options);
        }

        // Group
        if ($this->group) {
            $pattern = $route->getPattern();
            $pattern = rtrim($this->group, '/') . '/' . ltrim($pattern, '/');
            $route->setPattern($pattern);
        }

        // Add route
        if ($name = $route->getName()) {
            $this->routes[$name] = $route;
        } elseif (!$name || is_numeric($name)) {
            $this->routes[] = $route;
        }

        return $route;
    }
842266
protected function create($method)
    {
        !$this->config->has('log.file') ?: $this->registeLog();

        $gateway = __NAMESPACE__.'\\Gateways\\'.Str::studly($method);

        if (class_exists($gateway)) {
            return self::make($gateway);
        }

        throw new InvalidGatewayException("Gateway [{$method}] Not Exists");
    }
1128152
private function redirect($method) {

		$this -> setUrl();
		$this -> setDomain();
		$this -> setMethod($method);
		
		Router :: setRedirect(true);

		return Router :: execute();
	}
1188450
public function setMethod($method) {
        $method = (int) $method;
        switch ($this->method) {
            case self::METHOD_AUTO:
            case self::METHOD_GET:
            case self::METHOD_POST:
                $this->method = $method;
                break;
            default:
                throw new InvalidArgumentException();
        }
    }
953160
public function addRoute($method, $route, $callback)
    {
        $route = $this->router->addRoute(strtoupper($method), $this->prefix . '/' . $route, $callback);

        $route->onAny(function($event, $arguments){
            $this->emit($event, $arguments);
        });

        $this->routes[] = $route;

        return $route;
    }
190815
protected function setMethod($method) {
        switch ($method) {
            case self::HTTP_METHOD_DELETE:
            case self::HTTP_METHOD_GET:
            case self::HTTP_METHOD_HEAD:
            case self::HTTP_METHOD_OPTIONS:
            case self::HTTP_METHOD_PATCH:
            case self::HTTP_METHOD_POST:
            case self::HTTP_METHOD_PUT:
                $this->method = $method;
                break;
            default:
                throw new InvalidHTTPMethodException($method);
        }
        return $this;
    }
942461
public function addRoute($methods, $uri, $action)
    {
        // We do not keep routes in ApiRouter. Whenever a route is added,
        // we add it to Laravel's primary route collection
        $routes = app("router")->getRoutes();
        $prefix = config("api.prefix");

        if (empty($this->versions)) {
            if (($default = config("api.default_version")) !== null) {
                $versions = [$default];
            }
            else {
                $versions = [null];
            }

        }
        else {
            $versions = $this->versions;
        }


        // Add version prefix
        foreach ($versions as $version) {
            // Add ApiMiddleware to all routes
            $route = $this->createRoute($methods, $uri, $action);
            $route->middleware(ApiMiddleware::class);

            if ($version !== null) {
                $route->prefix($version);
                $route->name("." . $version);
            }

            if (!empty($prefix)) {
                $route->prefix($prefix);
            }

            $routes->add($route);

            // Options route
            $route = $this->createRoute(['OPTIONS'], $uri, function () {
                return [];
            });

            $route->middleware(ApiMiddleware::class);

            if ($version !== null) {
                $route->prefix($version);
                $route->name("." . $version);
            }

            if (!empty($prefix)) {
                $route->prefix($prefix);
            }

            $routes->add($route);
        }

        app("router")->setRoutes($routes);
    }