Sets the HTTP methods (e.g. 'POST') this route is restricted to.
So an empty array means that any method is allowed.

This method implements a fluent interface.

@param string|string[] $methods The method or an array of methods

@return $this
542135
public function setMethods($methods)
    {
        $this->methods = array_map('strtoupper', (array) $methods);
        $this->compiled = null;

        return $this;
    }
372224
public function method($method = null)
    {
        if ($method === null) {
            return $this->get('REQUEST_METHOD');
        }
        $this->set("REQUEST_METHOD", $method);
        return $this;
    }
967637
public function setMethod($method) {
        if ($this->configured) throw new IllegalStateException('Configuration is frozen');
        $name = $this->name ? ' name="'.$this->name.'"':'';
        $path = $this->path ? ' path="'.$this->path.'"':'';

        $method = strtoupper($method);
        if ($method!='GET' && $method!='POST') throw new StrutsConfigException('<mapping'.$name.''.$path.' methods="'.func_get_arg(0).'":  Invalid HTTP method.');

        $this->methods[$method] = true;
        return $this;
    }
832862
public function setMethodCalls(array $calls = array())
    {
        $this->calls = array();
        foreach ($calls as $call) {
            $this->addMethodCall($call[0], $call[1]);
        }

        return $this;
    }
987738
public function addMethods(array $methods)
    {
        foreach ($methods as $key => $method) {
            $this->addMethod($method, $key);
        }
        return $this;
    }
1016771
public function setMethod($method = null)
    {
        if ($method === null) {
            $method = isset($_SERVER['REQUEST_METHOD']) ? $_SERVER['REQUEST_METHOD'] : null;
        }

        $this->method = $method;
    }
945961
public function setMethod($method)
	{
		if ($method === null || !is_array($method) || empty($method)) {
			throw new InvalidArgumentException('No method provided');
		}

		foreach ($method as $m) {
			if (!in_array($m, array('GET','POST','PUT','PATCH','DELETE'))) {
				throw new InvalidArgumentException('Method not allowed. allowed methods: GET, POST, PUT, PATCH, DELETE');
			}
		}

		$this->method = $method;

		return $this;
	}
399431
public function setAccessControlAllowMethods($methods)
    {
        if (is_array($methods)) {
            $methods = implode(', ', $methods);
        }

        $this->setHeader('Access-Control-Allow-Methods', (string) $methods);

        return $this;
    }
733096
public function setMethod($method) {
        if (isset(static::$_methodOptionMap[$method])) {
            return $this->setOption(static::$_methodOptionMap[$method],true);
        } else {
            return $this->setOption(CURLOPT_CUSTOMREQUEST,$method);
        }
    }
716388
public function & via(...$methods){
      $this->methods = [];
      foreach ($methods as $method){
        $this->methods[strtolower($method)] = true;
      }
      return $this;
    }
370055
public function method($method = 'POST')
    {
        if (strtolower($method) == 'put') {
            $this->hidden('_method')->default($method);

            return $this;
        }

        return $this->attribute('method', strtoupper($method));
    }
105478
public static function create(array $methods): self
    {
        $manager = new self();
        foreach ($methods as $method) {
            $manager->add($method);
        }

        return $manager;
    }
453306
public function setAllowedHttpMethods(array $allowedHttpMethods = null)
    {
        $results = null;
        if (is_array($allowedHttpMethods)) {
            $results = array_map(function ($method) {
                $method = trim($method);
                $method = strtolower($method);

                return $method;
            }, $allowedHttpMethods);

            $results = array_combine($results, $results);
        }
        $this->allowedHttpMethods = $results;

        return $this;
    }
435100
public function setMethod($method) {
        $methods = array(
            COMPLETION_AGGREGATION_ALL,
            COMPLETION_AGGREGATION_ANY,
        );

        if (in_array($method, $methods)) {
            $this->method = $method;
        } else {
            $this->method = COMPLETION_AGGREGATION_ALL;
        }
    }
980405
public static function fromRouteFailure(?array $methods): self
    {
        $result = new self();
        $result->success = false;
        $result->allowedMethods = $methods;

        return $result;
    }
784197
public function allowMethod(string $method): Route
    {
        if (!in_array($method, self::$supportedMethods)) {
            throw new UnsupportedMethodException($method);
        }

        $this->methods[] = $method;

        return $this;
    }
345670
public function set( $method )
	{
		$method		= strtoupper( $method );
		if( !in_array( $method, self::$methods ) )
			throw new BadMethodCallException( 'HTTP method "%s" is not supported' );
		$this->method	= $method;
		return $this;
	}