Copied!

A header containing one or more email addresses and/or groups of addresses.

An address is separated by a comma, and each group separated by a semi-colon. The AddressHeader provides a complete list of all addresses referenced in a header including any addresses in groups, in addition to being able to access the groups separately if needed.

For full specifications, see {@link https://www.ietf.org/rfc/rfc2822.txt}

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 getAddresses() : array
 

Returns all address parts in the header including any addresses that are in groups (lists).

  • return \AddressPart[] The addresses.
public getEmail() : ?string
 

Returns the first email address in the header.

  • return ?string The email address
public getGroups() : array
 

Returns all group parts (lists) in the header.

  • return \AddressGroupPart[]
public ZBateson\MailMimeParser\Header\AbstractHeader::getName() : string
public ZBateson\MailMimeParser\Header\AbstractHeader::getParts() : array
 
  • return \IHeaderPart[]
public getPersonName() : ?string
 

Returns the name associated with the first email address to complement getValue()/getEmail() if one is set, or null if not.

  • return string|null The person name.
public ZBateson\MailMimeParser\Header\AbstractHeader::getRawValue() : string
public ZBateson\MailMimeParser\Header\AbstractHeader::getValue() : ?string
public hasAddress(string $email) : bool
 

Returns true if an address exists with the passed email address.

Comparison is done case insensitively.

Properties
protected $addresses = []
 
  • var \AddressPart[] array of addresses, included all addresses contained in groups.
protected $groups = []
 
  • var \AddressGroupPart[] array of address groups (lists).
protected ZBateson\MailMimeParser\Header\AbstractHeader::$name = NULL
 
  • var string the name of the header
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 an AddressBaseConsumer.

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

Overridden to extract all addresses into addresses array.

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