51 $stream = fopen(
'php://temp',
'r+');
71 if (is_string(
$body)) {
81 return stream_get_contents(
$body);
119 foreach ($this->headers as $headerInfo) {
120 $result[$headerInfo[0]] = $headerInfo[1];
134 return isset($this->headers[strtolower(
$name)]);
158 if (isset($this->headers[
$name])) {
159 return implode(
',', $this->headers[
$name][1]);
180 if (isset($this->headers[
$name])) {
181 return $this->headers[
$name][1];
201 $this->headers[strtolower(
$name)] = [
$name, (array)$value];
237 $lName = strtolower(
$name);
238 if (isset($this->headers[$lName])) {
239 $this->headers[$lName][1] = array_merge(
240 $this->headers[$lName][1],
244 $this->headers[$lName] = [
282 if (!isset($this->headers[
$name])) {
285 unset($this->headers[
$name]);
An exception for terminatinating execution or to throw for unit testing.
This is the abstract base class for both the Request and Response objects.
removeHeader($name)
Removes a HTTP header.
addHeader($name, $value)
Adds a HTTP header.
getHeaderAsArray($name)
Returns a HTTP header as an array.
getHttpVersion()
Returns the HTTP version.
setHeader($name, $value)
Updates a HTTP header.
setHttpVersion($version)
Sets the HTTP version.
addHeaders(array $headers)
Adds a new set of HTTP headers.
getBodyAsString()
Returns the body as a string.
getHeaders()
Returns all the HTTP headers as an array.
hasHeader($name)
Will return true or false, depending on if a HTTP header exists.
setHeaders(array $headers)
Sets a new set of HTTP headers.
getBody()
Returns the message body, as it's internal representation.
getBodyAsStream()
Returns the body as a readable stream resource.
getHeader($name)
Returns a specific HTTP header, based on it's name.
setBody($body)
Replaces the body resource with a new stream or string.
The MessageInterface is the base interface that's used by both the RequestInterface and ResponseInter...
if(preg_match('#\.( $contentLength[^/\.]+) $#D', $path, $type)) if($contentType===null)
$stream
PHP stream implementation.