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

Breadcrumb

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

function Headers::addHeader

Return value

$this

File

vendor/symfony/mime/Header/Headers.php, line 138

Class

Headers
A collection of headers.

Namespace

Symfony\Component\Mime\Header

Code

public function addHeader(string $name, mixed $argument, array $more = []) : static {
    $headerClass = self::HEADER_CLASS_MAP[strtolower($name)] ?? UnstructuredHeader::class;
    if (\is_array($headerClass)) {
        $headerClass = $headerClass[0];
    }
    $parts = explode('\\', $headerClass);
    $method = 'add' . ucfirst(array_pop($parts));
    if ('addUnstructuredHeader' === $method) {
        $method = 'addTextHeader';
    }
    elseif ('addIdentificationHeader' === $method) {
        $method = 'addIdHeader';
    }
    elseif ('addMailboxListHeader' === $method && !\is_array($argument)) {
        $argument = [
            $argument,
        ];
    }
    return $this->{$method}($name, $argument, $more);
}

API Navigation

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