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];
218 foreach ($headers as
$name => $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] = [
262 foreach ($headers as
$name => $value) {
282 if (!isset($this->headers[
$name])) {
285 unset($this->headers[$name]);
This is the abstract base class for both the Request and Response objects.
getHttpVersion()
Returns the HTTP version.
addHeaders(array $headers)
Adds a new set of HTTP headers.
$stream
PHP stream implementation.
hasHeader($name)
Will return true or false, depending on if a HTTP header exists.
setBody($body)
Replaces the body resource with a new stream or string.
if(preg_match('#\.( $contentLength[^/\.]+)$#D', $path, $type)) if($contentType===null)
setHeader($name, $value)
Updates a HTTP header.
removeHeader($name)
Removes a HTTP header.
getHeaderAsArray($name)
Returns a HTTP header as an array.
getHeaders()
Returns all the HTTP headers as an array.
The MessageInterface is the base interface that's used by both the RequestInterface and ResponseInter...
getBodyAsString()
Returns the body as a string.
addHeader($name, $value)
Adds a HTTP header.
setHeaders(array $headers)
Sets a new set of HTTP headers.
getBodyAsStream()
Returns the body as a readable stream resource.
getHeader($name)
Returns a specific HTTP header, based on it's name.
getBody()
Returns the message body, as it's internal representation.
setHttpVersion($version)
Sets the HTTP version.