AddressHeader extends AbstractHeader
Reads an address list header using the AddressBaseConsumer.
An address list may consist of one or more addresses and address groups. Each address separated by a comma, and each group separated by a semi-colon.
For full specifications, see https://www.ietf.org/rfc/rfc2822.txt
Tags
Table of Contents
- $addresses : array<string|int, AddressPart>
 - $groups : array<string|int, AddressGroupPart>
 - $name : string
 - $parts : array<string|int, HeaderPart>
 - $rawValue : string
 - __construct() : mixed
 - Assigns the header's name and raw value, then calls getConsumer and setParseHeaderValue to extract a parsed value.
 - __toString() : string
 - Returns the string representation of the header. At the moment this is just in the form of:
 - getAddresses() : array<string|int, AddressPart>
 - Returns all address parts in the header including all addresses that are in groups.
 - getEmail() : string
 - Same as getValue, but for clarity to match AddressPart.
 - getGroups() : array<string|int, AddressGroupPart>
 - Returns all group parts in the header.
 - getName() : string
 - Returns the name of the header.
 - getParts() : array<string|int, HeaderPart>
 - Returns an array of HeaderPart objects associated with this header.
 - getPersonName() : string
 - Returns the name associated with the first email address to complement getValue().
 - getRawValue() : string
 - Returns the raw value of the header prior to any processing.
 - getValue() : string
 - Returns the parsed value of the header -- calls getValue on $this->part
 - hasAddress() : bool
 - Returns true if an address exists with the passed email address.
 - getConsumer() : AbstractConsumer
 - Returns an AddressBaseConsumer.
 - setParseHeaderValue() : mixed
 - Overridden to extract all addresses into addresses array.
 
Properties
$addresses
    protected
        array<string|int, AddressPart>
    $addresses
     = []
        
    
$groups
    protected
        array<string|int, AddressGroupPart>
    $groups
     = []
        
    
$name
    protected
        string
    $name
    
        
    
$parts
    protected
        array<string|int, HeaderPart>
    $parts
    
        
    
$rawValue
    protected
        string
    $rawValue
    
        
    
Methods
__construct()
Assigns the header's name and raw value, then calls getConsumer and setParseHeaderValue to extract a parsed value.
    public
                __construct(ConsumerService $consumerService, string $name, string $value) : mixed
        
        Parameters
- $consumerService : ConsumerService
 - $name : string
 - $value : string
 
Return values
mixed —__toString()
Returns the string representation of the header. At the moment this is just in the form of:
    public
                __toString() : string
        No additional processing is performed (for instance to wrap long lines.)
Return values
string —getAddresses()
Returns all address parts in the header including all addresses that are in groups.
    public
                getAddresses() : array<string|int, AddressPart>
        
    
    
        Return values
array<string|int, AddressPart> —getEmail()
Same as getValue, but for clarity to match AddressPart.
    public
                getEmail() : string
        
    
    
        Return values
string —getGroups()
Returns all group parts in the header.
    public
                getGroups() : array<string|int, AddressGroupPart>
        
    
    
        Return values
array<string|int, AddressGroupPart> —getName()
Returns the name of the header.
    public
                getName() : string
        
    
    
        Return values
string —getParts()
Returns an array of HeaderPart objects associated with this header.
    public
                getParts() : array<string|int, HeaderPart>
        
    
    
        Return values
array<string|int, HeaderPart> —getPersonName()
Returns the name associated with the first email address to complement getValue().
    public
                getPersonName() : string
        
    
    
        Return values
string —getRawValue()
Returns the raw value of the header prior to any processing.
    public
                getRawValue() : string
        
    
    
        Return values
string —getValue()
Returns the parsed value of the header -- calls getValue on $this->part
    public
                getValue() : string
        
    
    
        Return values
string —hasAddress()
Returns true if an address exists with the passed email address.
    public
                hasAddress(string $email) : bool
        Comparison is done case insensitively.
Parameters
- $email : string
 
Return values
bool —getConsumer()
Returns an AddressBaseConsumer.
    protected
                getConsumer(ConsumerService $consumerService) : AbstractConsumer
        
        Parameters
- $consumerService : ConsumerService
 
Return values
AbstractConsumer —setParseHeaderValue()
Overridden to extract all addresses into addresses array.
    protected
                setParseHeaderValue(AbstractConsumer $consumer) : mixed
        
        Parameters
- $consumer : AbstractConsumer