You are here

public function HttpHeaderBag::remove in RESTful 7.2

Removes a header from the bag.

Parameters

string $key: The header ID or the header name.

Overrides HttpHeaderBagInterface::remove

File

src/Http/HttpHeaderBag.php, line 105
Contains \Drupal\restful\Http\HttpHeaderBag.

Class

HttpHeaderBag

Namespace

Drupal\restful\Http

Code

public function remove($key) {

  // Assume that $key is an ID.
  if (!array_key_exists($key, $this->values)) {

    // Test if key was a header name.
    $key = HttpHeader::generateId($key);
    if (!array_key_exists($key, $this->values)) {
      return;
    }
  }
  unset($this->values[$key]);
}