12 private $headers = [];
41 return $this->headers;
46 return isset($this->headerNames[strtolower(
$header)]);
53 if (!isset($this->headerNames[
$header])) {
57 $header = $this->headerNames[
$header];
69 if (!is_array($value)) {
74 $normalized = strtolower(
$header);
77 if (isset(
$new->headerNames[$normalized])) {
78 unset(
$new->headers[
$new->headerNames[$normalized]]);
88 if (!is_array($value)) {
93 $normalized = strtolower(
$header);
96 if (isset(
$new->headerNames[$normalized])) {
97 $header = $this->headerNames[$normalized];
109 $normalized = strtolower(
$header);
111 if (!isset($this->headerNames[$normalized])) {
115 $header = $this->headerNames[$normalized];
125 if (!$this->stream) {
134 if ($body === $this->stream) {
139 $new->stream = $body;
145 $this->headerNames = $this->headers = [];
146 foreach ($headers as
$header => $value) {
147 if (!is_array($value)) {
152 $normalized = strtolower(
$header);
153 if (isset($this->headerNames[$normalized])) {
154 $header = $this->headerNames[$normalized];
155 $this->headers[
$header] = array_merge($this->headers[
$header], $value);
157 $this->headerNames[$normalized] =
$header;
158 $this->headers[
$header] = $value;
179 return array_map(
function ($value) {
180 return trim($value,
" \t");
setHeaders(array $headers)
withHeader($header, $value)
withAddedHeader($header, $value)
$stream
PHP stream implementation.
stream_for($resource='', array $options=[])
Create a new stream based on the input type.
withBody(StreamInterface $body)
withProtocolVersion($version)
Create styles array
The data for the language used.
trimHeaderValues(array $values)
Trims whitespace from the header values.