You are here

public function ServerRequest::withMethod in Zircon Profile 8

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

Set the request method.

Unlike the regular Request implementation, the server-side normalizes the method to uppercase to ensure consistency and make checking the method simpler.

This methods returns a new instance.

Parameters

string $method:

Return value

self

Overrides RequestInterface::withMethod

File

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

Class

ServerRequest
Server-side HTTP request

Namespace

Zend\Diactoros

Code

public function withMethod($method) {
  $this
    ->validateMethod($method);
  $new = clone $this;
  $new->method = $method;
  return $new;
}