Copied!

Represents a header containing an optional main value part and subsequent name/value pairs.

If header doesn't contain a non-parameterized 'main' value part, 'getValue()' will return the value of the first parameter.

For example: 'Content-Type: text/html; charset=utf-8; name=test.ext'

The 'text/html' portion is considered the 'main' value, and 'charset' and 'name' are added as parameterized name/value pairs.

With the Autocrypt header, there is no main value portion, for example: 'Autocrypt: addr=zb@example.com; keydata=b64-data'

In that example, calling php $header->getValue() would return 'zb@example.com', as would calling php $header->getValueFor('addr'); .

CloneableInstantiable
Methods
public ZBateson\MailMimeParser\Header\AbstractHeader::__construct(ZBateson\MailMimeParser\Header\Consumer\ConsumerService $consumerService, string $name, string $value)
 

Assigns the header's name and raw value, then calls getConsumer and setParseHeaderValue to extract a parsed value.

  • param \ConsumerService $consumerService For parsing the value.
  • param string $name Name of the header.
  • param string $value Value of the header.
public ZBateson\MailMimeParser\Header\AbstractHeader::__toString() : string
public ZBateson\MailMimeParser\Header\AbstractHeader::getName() : string
public ZBateson\MailMimeParser\Header\AbstractHeader::getParts() : array
 
  • return \IHeaderPart[]
public ZBateson\MailMimeParser\Header\AbstractHeader::getRawValue() : string
public ZBateson\MailMimeParser\Header\AbstractHeader::getValue() : ?string
public getValueFor(string $name, ?string $defaultValue = NULL) : ?string
 

Returns the value of the parameter with the given name, or $defaultValue if not set.

  • param string $name The parameter to retrieve.
  • param string $defaultValue Optional default value (defaulting to null if not provided).
  • return string|null The parameter's value.
public hasParameter(string $name) : bool
 

Returns true if a parameter exists with the passed name.

  • param string $name The parameter to look up.
Properties
protected ZBateson\MailMimeParser\Header\AbstractHeader::$name = NULL
 
  • var string the name of the header
protected $parameters = []
 
  • var \ParameterPart[] key map of lower-case parameter names and associated ParameterParts.
protected ZBateson\MailMimeParser\Header\AbstractHeader::$parts = NULL
 
  • var \IHeaderPart[] the header's parts (as returned from the consumer)
protected ZBateson\MailMimeParser\Header\AbstractHeader::$rawValue = NULL
 
  • var string the raw value
Methods
protected getConsumer(ZBateson\MailMimeParser\Header\Consumer\ConsumerService $consumerService)
 

Returns a ParameterConsumer.

  • return \Consumer\AbstractConsumer
protected setParseHeaderValue(ZBateson\MailMimeParser\Header\Consumer\AbstractConsumer $consumer)
 

Overridden to assign ParameterParts to a map of lower-case parameter names to ParameterParts.

  • return static
© 2024 Bruce Wells
Search Namespaces \ Classes
Configuration