You are here

public function Request::getMethod in Zircon Profile 8

Same name in this branch
  1. 8 vendor/symfony/http-foundation/Request.php \Symfony\Component\HttpFoundation\Request::getMethod()
  2. 8 vendor/symfony/browser-kit/Request.php \Symfony\Component\BrowserKit\Request::getMethod()
  3. 8 vendor/guzzlehttp/psr7/src/Request.php \GuzzleHttp\Psr7\Request::getMethod()
  4. 8 vendor/jcalderonzumba/gastonjs/src/NetworkTraffic/Request.php \Zumba\GastonJS\NetworkTraffic\Request::getMethod()
Same name and namespace in other branches
  1. 8.0 vendor/symfony/http-foundation/Request.php \Symfony\Component\HttpFoundation\Request::getMethod()

Gets the request "intended" method.

If the X-HTTP-Method-Override header is set, and if the method is a POST, then it is used to determine the "real" intended HTTP method.

The _method request parameter can also be used to determine the HTTP method, but only if enableHttpMethodParameterOverride() has been called.

The method is always an uppercased string.

Return value

string The request method

See also

getRealMethod()

3 calls to Request::getMethod()
Request::isMethod in vendor/symfony/http-foundation/Request.php
Checks if the request method is of specified type.
Request::isMethodSafe in vendor/symfony/http-foundation/Request.php
Checks whether the method is safe or not.
Request::__toString in vendor/symfony/http-foundation/Request.php
Returns the request as a string.

File

vendor/symfony/http-foundation/Request.php, line 1275

Class

Request
Request represents an HTTP request.

Namespace

Symfony\Component\HttpFoundation

Code

public function getMethod() {
  if (null === $this->method) {
    $this->method = strtoupper($this->server
      ->get('REQUEST_METHOD', 'GET'));
    if ('POST' === $this->method) {
      if ($method = $this->headers
        ->get('X-HTTP-METHOD-OVERRIDE')) {
        $this->method = strtoupper($method);
      }
      elseif (self::$httpMethodParameterOverride) {
        $this->method = strtoupper($this->request
          ->get('_method', $this->query
          ->get('_method', 'POST')));
      }
    }
  }
  return $this->method;
}