You are here

private function HtmlResponse::createBody in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/zendframework/zend-diactoros/src/Response/HtmlResponse.php \Zend\Diactoros\Response\HtmlResponse::createBody()

Create the message body.

Parameters

string|StreamInterface $html:

Return value

StreamInterface

Throws

InvalidArgumentException if $html is neither a string or stream.

1 call to HtmlResponse::createBody()
HtmlResponse::__construct in vendor/zendframework/zend-diactoros/src/Response/HtmlResponse.php
Create an HTML response.

File

vendor/zendframework/zend-diactoros/src/Response/HtmlResponse.php, line 55

Class

HtmlResponse
HTML response.

Namespace

Zend\Diactoros\Response

Code

private function createBody($html) {
  if ($html instanceof StreamInterface) {
    return $html;
  }
  if (!is_string($html)) {
    throw new InvalidArgumentException(sprintf('Invalid content (%s) provided to %s', is_object($html) ? get_class($html) : gettype($html), __CLASS__));
  }
  $body = new Stream('php://temp', 'wb+');
  $body
    ->write($html);
  return $body;
}