createBody($content), $status, $this->injectContentType('application/pdf; charset=utf-8', $headers) ); } /** * Create the message body. * * @param string|StreamInterface $content * @throws Exception\InvalidArgumentException if $content is neither a string or stream. */ private function createBody($content) : StreamInterface { if ($content instanceof StreamInterface) { return $content; } if (! is_string($content)) { throw new Exception\InvalidArgumentException(sprintf( 'Invalid content (%s) provided to %s', (is_object($content) ? get_class($content) : gettype($content)), __CLASS__ )); } $body = new Stream('php://temp', 'wb+'); $body->write($content); $body->rewind(); return $body; } }