Copied!

Parses a single group of addresses (as a named-group part of an address
header).

Finds addresses using its AddressConsumer sub-consumer separated by commas,
and ends processing once a semi-colon is found.

Prior to returning to its calling client, AddressGroupConsumer constructs a
single Part\AddressGroupPart object filling it with all located addresses,
and returns it.

The AddressGroupConsumer extends AddressBaseConsumer to define start/end
tokens, token separators, and construct a Part\AddressGroupPart to return.

CloneableInstantiable
Methods
public ZBateson\MailMimeParser\Header\Consumer\AbstractConsumer::__construct(ZBateson\MailMimeParser\Header\Consumer\ConsumerService $consumerService, ZBateson\MailMimeParser\Header\Part\HeaderPartFactory $partFactory)
public ZBateson\MailMimeParser\Header\Consumer\AbstractConsumer::__invoke( $value)
 

Invokes parsing of a header's value into header parts.

public static ZBateson\MailMimeParser\Header\Consumer\AbstractConsumer::getInstance(ZBateson\MailMimeParser\Header\Consumer\ConsumerService $consumerService, ZBateson\MailMimeParser\Header\Part\HeaderPartFactory $partFactory)
 

Returns the singleton instance for the class.

public getTokenSeparators()
 

Overridden to return patterns matching the beginning and end markers of a
group address: colon and semi-colon (":" and ";") characters.

Properties
protected ZBateson\MailMimeParser\Header\Consumer\AbstractConsumer::$consumerService
 
protected ZBateson\MailMimeParser\Header\Consumer\AbstractConsumer::$partFactory
 
Methods
protected ZBateson\MailMimeParser\Header\Consumer\AddressBaseConsumer::advanceToNextToken(Iterator $tokens, $isStartToken)
 

Disables advancing for start tokens.

The start token for AddressBaseConsumer is part of an AddressPart (or a
sub-consumer) and so must be passed on.

protected ZBateson\MailMimeParser\Header\Consumer\AbstractConsumer::getAllConsumers()
 

Returns this consumer and all unique sub consumers.

Loops into the sub-consumers (and their sub-consumers, etc...) finding
all unique consumers, and returns them in an array.

protected ZBateson\MailMimeParser\Header\Consumer\AbstractConsumer::getAllTokenSeparators()
 

Returns a list of regular expression markers for this consumer and all
sub-consumers by calling getTokenSeparators().

protected ZBateson\MailMimeParser\Header\Consumer\AbstractConsumer::getConsumerTokenParts(Iterator $tokens)
 

Iterates through this consumer's sub-consumers checking if the current
token triggers a sub-consumer's start token and passes control onto that
sub-consumer's parseTokenIntoParts().

If no sub-consumer is responsible for the current token, calls
{@see \AbstractConsumer::getPartForToken()} and returns it in an array.

protected ZBateson\MailMimeParser\Header\Consumer\AddressBaseConsumer::getPartForToken( $token, $isLiteral)
 

Never reached by AddressBaseConsumer. Overridden to satisfy
AbstractConsumer.

protected ZBateson\MailMimeParser\Header\Consumer\AddressBaseConsumer::getSubConsumers()
 

Returns \ZBateson\MailMimeParser\Header\Consumer\AddressConsumer as a
sub-consumer.

protected ZBateson\MailMimeParser\Header\Consumer\AddressBaseConsumer::getTokenParts(Iterator $tokens)
 

Overridden so tokens aren't handled at this level, and instead are passed
on to AddressConsumer.

protected ZBateson\MailMimeParser\Header\Consumer\AbstractConsumer::getTokenSplitPattern()
 

Returns a regex pattern used to split the input header string.

The default implementation calls
{@see \AbstractConsumer::getAllTokenSeparators()} and implodes the
returned array with the regex OR '|' character as its glue.

protected isEndToken( $token)
 

AddressGroupConsumer returns true if the passed token is a semi-colon.

protected isStartToken( $token)
 

AddressGroupConsumer returns true if the passed token is a colon.

protected ZBateson\MailMimeParser\Header\Consumer\AbstractConsumer::parseTokensIntoParts(Iterator $tokens)
 

Iterates over the passed token Iterator and returns an array of parsed
IHeaderPart objects.

The method checks each token to see if the token matches a sub-consumer's
start token, or if it matches the current consumer's end token to stop
processing.

If a sub-consumer's start token is matched, the sub-consumer is invoked
and its returned parts are merged to the current consumer's header parts.

After all tokens are read and an array of Header\Parts are constructed,
the array is passed to AbstractConsumer::processParts for any final
processing.

protected processParts(array $parts)
 

Performs post-processing on parsed parts.

AddressGroupConsumer returns an array with a single Part\AddressGroupPart
element with all email addresses from this and any sub-groups.

protected ZBateson\MailMimeParser\Header\Consumer\AbstractConsumer::splitRawValue( $rawValue)
 

Returns an array of split tokens from the input string.

The method calls preg_split using
{@see \AbstractConsumer::getTokenSplitPattern()}. The split array will
not contain any empty parts and will contain the markers.

Methods
public static ZBateson\MailMimeParser\Header\Consumer\AbstractConsumer::getInstance(ZBateson\MailMimeParser\Header\Consumer\ConsumerService $consumerService, ZBateson\MailMimeParser\Header\Part\HeaderPartFactory $partFactory)
 

Returns the singleton instance for the class.

© 2023 Bruce Wells
Search Namespaces \ Classes
Configuration