public function Request::getMethod

Same name in this branch

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.

@api

Return value

string The request method

See also

getRealMethod

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

File

drupal/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Request.php, line 1104

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;
}