11use InvalidArgumentException;
101 if (!isset(self::$validProtocolVersions[
$version])) {
102 throw new InvalidArgumentException(
103 'Invalid HTTP version. Must be one of: '
104 . implode(
', ', array_keys(self::$validProtocolVersions))
107 $clone = clone $this;
144 return $this->headers->all();
157 return $this->headers->has(
$name);
176 return $this->headers->get(
$name, []);
200 return implode(
',', $this->headers->get(
$name, []));
220 $clone = clone $this;
221 $clone->headers->set(
$name, $value);
244 $clone = clone $this;
245 $clone->headers->add(
$name, $value);
264 $clone = clone $this;
265 $clone->headers->remove(
$name);
300 $clone = clone $this;
301 $clone->body =
$body;
An exception for terminatinating execution or to throw for unit testing.
Abstract message (base class for Request and Response)
withHeader($name, $value)
Return an instance with the provided value replacing the specified header.
withAddedHeader($name, $value)
Return an instance with the specified header appended with the given value.
getHeaderLine($name)
Retrieves a comma-separated string of the values for a single header.
getProtocolVersion()
Retrieves the HTTP protocol version as a string.
getHeader($name)
Retrieves a message header value by the given case-insensitive name.
hasHeader($name)
Checks if a header exists by the given case-insensitive name.
getHeaders()
Retrieves all message header values.
static $validProtocolVersions
withBody(StreamInterface $body)
Return an instance with the specified message body.
getBody()
Gets the body of the message.
withoutHeader($name)
Return an instance without the specified header.
__set($name, $value)
Disable magic setter to ensure immutability.
withProtocolVersion($version)
Return an instance with the specified HTTP protocol version.
HTTP messages consist of requests from a client to a server and responses from a server to a client.
Slim Framework (https://slimframework.com)