You are here

public function ServerRequest::withParsedBody in Zircon Profile 8

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

Return an instance with the specified body parameters.

These MAY be injected during instantiation.

If the request Content-Type is either application/x-www-form-urlencoded or multipart/form-data, and the request method is POST, use this method ONLY to inject the contents of $_POST.

The data IS NOT REQUIRED to come from $_POST, but MUST be the results of deserializing the request body content. Deserialization/parsing returns structured data, and, as such, this method ONLY accepts arrays or objects, or a null value if nothing was available to parse.

As an example, if content negotiation determines that the request data is a JSON payload, this method could be used to create a request instance with the deserialized parameters.

This method MUST be implemented in such a way as to retain the immutability of the message, and MUST return an instance that has the updated body parameters.

Parameters

null|array|object $data The deserialized body data. This will: typically be in an array or object.

Return value

self

Throws

\InvalidArgumentException if an unsupported argument type is provided.

Overrides ServerRequestInterface::withParsedBody

File

vendor/symfony/psr-http-message-bridge/Tests/Fixtures/ServerRequest.php, line 117

Class

ServerRequest
@author Kévin Dunglas <dunglas@gmail.com>

Namespace

Symfony\Bridge\PsrHttpMessage\Tests\Fixtures

Code

public function withParsedBody($data) {
  throw new \BadMethodCallException('Not implemented.');
}