Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. HeaderBag.php

function HeaderBag::get

Returns the first header by name or the default one.

1 call to HeaderBag::get()
HeaderBag::getDate in vendor/symfony/http-foundation/HeaderBag.php
Returns the HTTP header value converted to a date.

File

vendor/symfony/http-foundation/HeaderBag.php, line 109

Class

HeaderBag
HeaderBag is a container for HTTP headers.

Namespace

Symfony\Component\HttpFoundation

Code

public function get(string $key, ?string $default = null) : ?string {
    $headers = $this->all($key);
    if (!$headers) {
        return $default;
    }
    if (null === $headers[0]) {
        return null;
    }
    return $headers[0];
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal