X-Git-Url: http://www.aleph1.co.uk/gitweb/?a=blobdiff_plain;ds=sidebyside;f=vendor%2Fzendframework%2Fzend-diactoros%2Fsrc%2FResponse%2FHtmlResponse.php;fp=vendor%2Fzendframework%2Fzend-diactoros%2Fsrc%2FResponse%2FHtmlResponse.php;h=1e1f032a97edd01fb6f3b3ef72a33ed309e95155;hb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae;hp=0000000000000000000000000000000000000000;hpb=57c063afa3f66b07c4bbddc2d6129a96d90f0aad;p=yaffs-website diff --git a/vendor/zendframework/zend-diactoros/src/Response/HtmlResponse.php b/vendor/zendframework/zend-diactoros/src/Response/HtmlResponse.php new file mode 100644 index 000000000..1e1f032a9 --- /dev/null +++ b/vendor/zendframework/zend-diactoros/src/Response/HtmlResponse.php @@ -0,0 +1,74 @@ +createBody($html), + $status, + $this->injectContentType('text/html; charset=utf-8', $headers) + ); + } + + /** + * Create the message body. + * + * @param string|StreamInterface $html + * @return StreamInterface + * @throws InvalidArgumentException if $html is neither a string or stream. + */ + 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); + $body->rewind(); + return $body; + } +}