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/zendframework/zend-diactoros/src/MessageTrait.php \Zend\Diactoros\MessageTrait::withoutHeader()

Return an instance without the specified header.

Header resolution MUST be done without case-sensitivity.

This method MUST be implemented in such a way as to retain the immutability of the message, and MUST return an instance that removes the named header.

Parameters

string $header Case-insensitive header field name to remove.:

Return value

static

File

vendor/zendframework/zend-diactoros/src/MessageTrait.php, line 269

Class

MessageTrait
Trait implementing the various methods defined in MessageInterface.

Namespace

Zend\Diactoros

Code

public function withoutHeader($header) {
  if (!$this
    ->hasHeader($header)) {
    return clone $this;
  }
  $normalized = strtolower($header);
  $original = $this->headerNames[$normalized];
  $new = clone $this;
  unset($new->headers[$original], $new->headerNames[$normalized]);
  return $new;
}