Set the method.

@param string $method The method.
@return AbstractCURLRequest Returns this request.
@throws InvalidHTTPMethodException Throws an invalid HTTP method exception if the method is not implemented.
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;
    }
458688
public function request($method = null)
	{
		# Verifying if was set method.
		if (!is_null($method)) $this->setMethod($method);
		
		# Verifying if URI is setted.
		if (is_null($this->uri)) {
			throw new RuntimeException('URI must be set before calling request method.');
		}
		
		# Setting default CURL options
		$this->setCurlOpts($this->defaultCurlOpts);
		
		# Verifying and preparing request for specified method.
		switch ($this->method) {
			case 'GET' : 
				// Specific routines for GET request.
				break;
			case 'POST' :
				$this->setCurlOpts(CURLOPT_POST, true); 
				
				if ($this->useRawData) {
					$this->setCurlOpts(CURLOPT_POSTFIELDS, $this->dataRaw);
				} else {
					// Verifying if has files to send
					if (count($this->files) > 0) {
						foreach ($this->files as $k => $v) {
							// Verifying if PHP version is over 5.4
							if (PHP_VERSION_ID < 50500) {
								$this->setParameterPost($k, "@$v");
							} else {
								$cFile = new CURLFile($v,mime_content_type($v),$k);
								$this->setParameterPost($k, $cFile);
							}
						} 
					}
					$this->setCurlOpts(CURLOPT_POSTFIELDS, $this->paramsPost);
				}
				break;
			case 'PUT' : 
				$this->setCurlOpts(CURLOPT_CUSTOMREQUEST, "PUT");
				if ($this->useRawData) {
					$this->setCurlOpts(CURLOPT_POSTFIELDS, $this->dataRaw);
				} else {
					$data = http_build_query($this->paramsPost);
					$this->setCurlOpts(CURLOPT_POSTFIELDS, $data);
				}
				break;
			case 'DELETE' : 
				$this->setCurlOpts(CURLOPT_CUSTOMREQUEST, "DELETE");
				break;
		}
		
		# Rendering GET parameters into a query string.
		$queryString = (count($this->paramsGet) > 0) ? '?' . http_build_query($this->paramsGet) : '';
		
		# Preparing and setting URI in CURL options
		$uri = $this->uri . $queryString;
		$this->setCurlOpts(CURLOPT_URL, $uri);
		
		# Parsing headers
		$headers = array();
		foreach ($this->headers as $key => $value) {
			$headers[] = $key . ': ' . $value;
		}
		$this->setCurlOpts(CURLOPT_HTTPHEADER, $headers);
		
		# Setting remaining options in CURL
		$this->setCurlOpts(array(
			CURLOPT_HTTP_VERSION=>$this->httpVersion,
		));
		
		# Initializing Request
		$ch = curl_init();
		curl_setopt_array($ch, $this->curlOpts);
		
		# Performing Request
		$response = curl_exec($ch);
		
		# Verifying if request was successfully executed.
		if (!$response) {
			throw new RuntimeException('cURL Request Error: ' . curl_errno($ch));
		}
		
		# Closing handle
		curl_close($ch);
		
		# Verifying if a custom response handler was set
		if (!is_null($this->responseHandler)) {
			$this->response = $this->responseHandler->fromString($response);
		} else {
			$this->response = Response::fromString($response);
		}
		
		# Saving last instance in Client
		$this->lastRequest = clone $this;
		
		# Verifying noReset control var
		if (!$this->noReset) {
			$this->reset();
		}
		
		return $this->response;
	}
398386
public function set(string $link = null, string $method = null): \TheCMSThread\Classes\API
    {
        if ($link === null) {
            if (isset($_SERVER['REQUEST_URI']) === false) {
                $_SERVER['REQUEST_URI'] = '/';
            }
            $link = str_replace("?" . $_SERVER["QUERY_STRING"], "", $_SERVER["REQUEST_URI"]);
        }
        $link = '/' . trim($link, '/');

        if ($method === null) {
            if (isset($_SERVER['REQUEST_METHOD']) === false) {
                $_SERVER['REQUEST_METHOD'] = 'GET';
            }
            $method = $_SERVER['REQUEST_METHOD'];
        }
        if ($method == 'POST' && empty($_POST['_method']) === false) {
            $method = $_POST['_method'];
            unset($_POST['_method']);
        }

        $this->match = $this->router->match($link, $method);
        return $this;
    }
852242
protected function setRequestMethod($method)
    {
        // Preventing request methods collision
        $this->removeOption(CURLOPT_NOBODY);
        $this->removeOption(CURLOPT_HTTPGET);
        $this->removeOption(CURLOPT_POST);
        $this->removeOption(CURLOPT_CUSTOMREQUEST);

        switch (strtoupper($method)) {
            case 'HEAD':
                $this->addOption(CURLOPT_NOBODY, true);
            break;

            case 'GET':
                $this->addOption(CURLOPT_HTTPGET, true);
            break;

            case 'POST':
                $this->addOption(CURLOPT_POST, true);
            break;

            case 'RAW_POST':
                $this->addOption(CURLOPT_CUSTOMREQUEST, 'POST');
            break;

            default:
                $this->addOption(CURLOPT_CUSTOMREQUEST, $method);
        }
    }
583434
public function setMethod($method)
    {
        $method = strtoupper($method);
        if (!defined('static::METHOD_' . $method) && !$this->getAllowCustomMethods()) {
            throw new \InvalidArgumentException('Invalid HTTP method passed');
        }
        $this->method = $method;
        return $this;
    }
650483
protected function filterMethod($method)
    {
        if ($method === null) {
            return $method;
        }

        if (!is_string($method)) {
            throw new \InvalidArgumentException(
                sprintf(
                    'Unsupported HTTP method; must be a string, received %s',
                    is_object($method) ? get_class($method) : gettype($method)
                )
            );
        }

        $method = strtoupper($method);

        if (!in_array($method, self::$validMethods)) {
            throw new \InvalidArgumentException(sprintf('Invalid HTTP method "%s" provided', $method));
        }

        return $method;
    }
270484
public function setNumChildrenMethod($method)
    {
        // Check method is valid
        if (!$this->rootNode->hasMethod($method)) {
            throw new InvalidArgumentException(sprintf(
                "Can't find the method '%s' on class '%s' for counting tree children",
                $method,
                get_class($this->rootNode)
            ));
        }
        $this->numChildrenMethod = $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;
	}
940010
public function method($method)
    {
        $this->headers = array_merge($this->headers, array('X-HTTP-Method-Override: ' . $method));
        $this->setOption(CURLOPT_CUSTOMREQUEST, $method);
        $this->setOption(CURLOPT_HTTPHEADER, $this->headers);
    }
807552
public function setFormMethod($method)
    {
        $methods = [
            'post',
            'get'
        ];

        // Safety first. Only allow 'post' or 'get' here.
        if (! in_array($method, $methods)) {
            Throw new FormException('Wrong method set.');
        }

        $this->attribute['formmethod'] = $method;

        return $this;
    }
730355
public function setMethod($method)
    {
        $method = strtolower($method);

        if (in_array($method, [Form::METHOD_GET, Form::METHOD_POST])) {
            $this->method = $method;
        } else {
            throw new \Exception('Incorrect method value given');
        }
        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());
        }
    }
749366
public function withMethod($method)
    {
        $method = strtoupper($method);

        if (false === in_array($method, ['GET', 'HEAD', 'POST', 'PUT', 'OPTIONS', 'DELETE'])) {
            throw new \InvalidArgumentException(
                sprintf('Invalid HTTP method: %s', $method)
            );
        }

        return $this->_clone('method', $method);
    }
370055
public function method($method = 'POST')
    {
        if (strtolower($method) == 'put') {
            $this->hidden('_method')->default($method);

            return $this;
        }

        return $this->attribute('method', strtoupper($method));
    }
1016443
public final function setMethod($method)
    {
        if (preg_match('/get|post|put|delete/i', $method, $matches) !== 1) {

            throw new ehough_shortstop_api_exception_InvalidArgumentException(
                'Method must be PUT, GET, POST, or DELETE'
            );
        }

        $this->_method = strtoupper($method);
    }
372224
public function method($method = null)
    {
        if ($method === null) {
            return $this->get('REQUEST_METHOD');
        }
        $this->set("REQUEST_METHOD", $method);
        return $this;
    }
109777
public function setMethod(string $method = 'POST'): ButtonInterface
    {
        if ($this->isVisibility()) {
            $this->method = $method;
        }

        return $this;
    }