设置请求的 Method。

@param $method
439916
private function setHttpMethodOption($method)
    {
        $method = strtoupper($method);
        $allow_methods = ['GET', 'PUT', 'DELETE', 'OPTIONS', 'PATCH', 'HEAD'];
        if ($method == 'POST') {
            curl_setopt($this->_curl, CURLOPT_POST, true);
            curl_setopt($this->_curl, CURLOPT_CUSTOMREQUEST, $method);
        } else if (in_array($method, $allow_methods)) {
            curl_setopt($this->_curl, CURLOPT_POST, false);
            curl_setopt($this->_curl, CURLOPT_CUSTOMREQUEST, $method);
            // 解决 HEAD 请求超时问题。
            if ($method == 'HEAD') {
                curl_setopt($this->_curl, CURLOPT_NOBODY, true);
            }
        }
    }
558759
public function setMethod($method) {
        $this->method = (true === in_array($method, [self::HTTP_METHOD_GET, self::HTTP_METHOD_POST]) ? $method : self::HTTP_METHOD_POST);
        return $this;
    }
365133
public function setMethod(string $method) : self
    {
        if ($method == 'GET') {
            $this->setCsrf(false);
        }

        return $this->addAttribute('method', $method);
    }
1048545
protected function validateMethod($method) : void
	{
		if (! \is_string($method))
		{
			throw new \InvalidArgumentException('HTTP method must be a string');
		}
		else if (! \preg_match(HeaderInterface::RFC7230_TOKEN, $method))
		{
			throw new \InvalidArgumentException(\sprintf('The given method "%s" is not valid', $method));
		}
	}
22879
public function findMethod($method = null)
    {
        if ($method === null) {
            return $this->getConfig('findMethod');
        }

        return $this->setConfig('findMethod', $method);
    }
372224
public function method($method = null)
    {
        if ($method === null) {
            return $this->get('REQUEST_METHOD');
        }
        $this->set("REQUEST_METHOD", $method);
        return $this;
    }
224885
public function isMethod($methods)
    {
        if (is_array($methods)) {
            return in_array($this->getMethod(), $methods);
        }

        if (is_string($methods)) {
            return ($this->getMethod() == $methods);
        }

        return false;
    }
1166404
public function register($method): void
    {
        $data = ensure_data($method)
            ->isTypeOf(Type::STRING, Type::ARRAY, Type::CALLABLE)
            ->end();

        if ($data->isString()) {
            $method = [$this, $method];
        }

        $this->methods->push($method);
    }
926392
public function methodsEnd($method) {
        if (is_string($method)) {
            $method = array($method);
        }
        $this->rule = "end";
        $this->method = $method;
        return $this;
    }
1032824
public function setPaymentMethod($method)
    {
        try {
            if ($method instanceof PagSeguroDirectPaymentMethods) {
                $this->paymentMethod = $method;
            } else {
                $this->paymentMethod = new PagSeguroDirectPaymentMethods($method);
            }
        } catch (Exception $e) {
            die($e->getMessage());
        }
    }
994375
public function setRoute($method, $args)
    {
        $pattern = array_shift($args);
        $callable = array_pop($args);

        //包含额外的参数
        if (count($args) > 0) {
            //额外的参数为单独的调用中间件
            foreach ($args as $call) {
                if (!is_callable($call)) {
                    continue;
                }
                $this->invoke($pattern, $call);
            }
        }
        $this->route->register($method, $pattern, $callable);
    }
198136
public function setServiceMethod(string $method): void
    {
        $this->service && $this->service->setMethod($method);
    }
370055
public function method($method = 'POST')
    {
        if (strtolower($method) == 'put') {
            $this->hidden('_method')->default($method);

            return $this;
        }

        return $this->attribute('method', strtoupper($method));
    }
88395
final public function runAppController($method)
    {
        //检测csrf跨站攻击
        Secure::checkCsrf(Config::get('check_csrf'));

        // 关闭GPC过滤 防止数据的正确性受到影响 在db层防注入
        if (get_magic_quotes_gpc()) {
            Secure::stripslashes($_GET);
            Secure::stripslashes($_POST);
            Secure::stripslashes($_COOKIE);
            Secure::stripslashes($_REQUEST); //在程序中对get post cookie的改变不影响 request的值
        }

        //session保存方式自定义
        if (Config::get('session_user')) {
            Session::init();
        } else {
            ini_get('session.auto_start') || session_start(); //自动开启session
        }

        header('Cache-control: ' . Config::get('http_cache_control'));  // 页面缓存控制

        //如果有子类中有init()方法 执行Init() eg:做权限控制
        if (method_exists($this, "init")) {
            $this->init();
        }

        //根据动作去找对应的方法
        if (method_exists($this, $method)) {
            $response = $this->$method();
            if (is_array($response)) {
                if (Request::acceptJson()) {
                    View::getEngine('Json')
                        ->assign($response)
                        ->display();
                } else {
                    $tpl = isset($this->htmlEngineRenderTplArray[$method])
                        ? $this->htmlEngineRenderTplArray[$method]
                        : Cml::getContainer()->make('cml_route')->getControllerName() . '/' . $method;

                    call_user_func_array([View::getEngine('Html')->assign($response), is_array($tpl) ? 'displayWithLayout' : 'display'], is_array($tpl) ? $tpl : [$tpl]);
                }
            }
        } elseif (Cml::$debug) {
            Cml::montFor404Page();
            throw new \BadMethodCallException(Lang::get('_ACTION_NOT_FOUND_', $method));
        } else {
            Cml::montFor404Page();
            Response::show404Page();
        }
    }
458360
public function addMethod(Method $method): void
    {
        $this->methods[(string) $method->getFqsen()] = $method;
    }
230323
public final function isAllowedRequestMethod(string $method): bool
    {
        return $this->allowedRequestMethods == null || in_array($method, (array) $this->allowedRequestMethods);
    }
642229
public function setMethod($method)
    {
        $valid_methods = array(self::METHOD_POST, self::METHOD_GET);

        if (!in_array($method, $valid_methods)) {
            throw new SwatException("‘{$method}’ is not a valid form method.");
        }

        $this->method = $method;
    }