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