You are here

public function MessageTrait::withoutHeader in Zircon Profile 8

Same name in this branch
  1. 8 vendor/zendframework/zend-diactoros/src/MessageTrait.php \Zend\Diactoros\MessageTrait::withoutHeader()
  2. 8 vendor/guzzlehttp/psr7/src/MessageTrait.php \GuzzleHttp\Psr7\MessageTrait::withoutHeader()
Same name and namespace in other branches
  1. 8.0 vendor/guzzlehttp/psr7/src/MessageTrait.php \GuzzleHttp\Psr7\MessageTrait::withoutHeader()

File

vendor/guzzlehttp/psr7/src/MessageTrait.php, line 100

Class

MessageTrait
Trait implementing functionality common to requests and responses.

Namespace

GuzzleHttp\Psr7

Code

public function withoutHeader($header) {
  if (!$this
    ->hasHeader($header)) {
    return $this;
  }
  $new = clone $this;
  $name = strtolower($header);
  unset($new->headers[$name]);
  foreach (array_keys($new->headerLines) as $key) {
    if (strtolower($key) === $name) {
      unset($new->headerLines[$key]);
    }
  }
  return $new;
}