Set the EntityBody that will hold the response message's entity body.
This method should be invoked when you need to send the response's entity body somewhere other than the normal php://temp buffer. For example, you can send the entity body to a socket, file, or some other custom stream.
EntityBodyInterface|string|resource $body Response body object. Pass a string to attempt to store the: response body in a local file.
Overrides RequestInterface::setResponseBody
public function setResponseBody($body) {
// Attempt to open a file for writing if a string was passed
if (is_string($body)) {
// @codeCoverageIgnoreStart
if (!($body = fopen($body, 'w+'))) {
throw new InvalidArgumentException('Could not open ' . $body . ' for writing');
}
// @codeCoverageIgnoreEnd
}
$this->responseBody = EntityBody::factory($body);
return $this;
}