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
string The request method
getRealMethod
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;
}