@@ 194-201 (lines=8) @@ | ||
191 | * @return static |
|
192 | * @throws \InvalidArgumentException for invalid header names or values. |
|
193 | */ |
|
194 | public function withHeader($name, $value) |
|
195 | { |
|
196 | $key = $this->headerKey($name); |
|
197 | ||
198 | $message = clone $this; |
|
199 | $message->headers[$key] = is_array($value) ? $value : [$value]; |
|
200 | return $message; |
|
201 | } |
|
202 | ||
203 | /** |
|
204 | * Return an instance with the specified header appended with the given value. |
|
@@ 241-251 (lines=11) @@ | ||
238 | * @param string $name Case-insensitive header field name to remove. |
|
239 | * @return static |
|
240 | */ |
|
241 | public function withoutHeader($name) |
|
242 | { |
|
243 | $message = clone $this; |
|
244 | $key = $this->headerKey($name); |
|
245 | ||
246 | if (array_key_exists($key, $message->headers)) { |
|
247 | unset($message->headers[$key]); |
|
248 | } |
|
249 | ||
250 | return $message; |
|
251 | } |
|
252 | ||
253 | /** |
|
254 | * Gets the body of the message. |