You are here

public function ServerRequest::getMethod in Zircon Profile 8.0

Same name in this branch
  1. 8.0 vendor/zendframework/zend-diactoros/src/ServerRequest.php \Zend\Diactoros\ServerRequest::getMethod()
  2. 8.0 vendor/symfony/psr-http-message-bridge/Tests/Fixtures/ServerRequest.php \Symfony\Bridge\PsrHttpMessage\Tests\Fixtures\ServerRequest::getMethod()
Same name and namespace in other branches
  1. 8 vendor/zendframework/zend-diactoros/src/ServerRequest.php \Zend\Diactoros\ServerRequest::getMethod()

Proxy to receive the request method.

This overrides the parent functionality to ensure the method is never empty; if no method is present, it returns 'GET'.

Return value

string

Overrides RequestInterface::getMethod

File

vendor/zendframework/zend-diactoros/src/ServerRequest.php, line 223

Class

ServerRequest
Server-side HTTP request

Namespace

Zend\Diactoros

Code

public function getMethod() {
  if (empty($this->method)) {
    return 'GET';
  }
  return $this->method;
}