Abstract base class for all header token consumers.
Defines the base parser that loops over tokens, consuming them and creating
header parts.
- author Zaahid Bateson
- Children
Methods |
public __construct(ZBateson |
public __invoke(string $value) : array Invokes parsing of a header's value into header parts.
|
public static getInstance(ZBateson Returns the singleton instance for the class. |
Properties |
protected $consumerService = NULL
|
protected $partFactory = NULL
|
Methods |
protected advanceToNextToken(Iterator $tokens, bool $isStartToken) Determines if the iterator should be advanced to the next token after The default implementation will advance for a start token, but not
|
protected getAllConsumers() : array Returns this consumer and all unique sub consumers. Loops into the sub-consumers (and their sub-consumers, etc...) finding
|
protected getAllTokenSeparators() : array Returns a list of regular expression markers for this consumer and all
|
protected getConsumerTokenParts(Iterator $tokens) : array Iterates through this consumer's sub-consumers checking if the current If no sub-consumer is responsible for the current token, calls
|
protected getPartForToken(string $token, bool $isLiteral) Constructs and returns an IHeaderPart for the passed string token. If the token should be ignored, the function must return null. The default created part uses the instance's partFactory->newInstance
|
protected abstract getSubConsumers() : array Returns an array of sub-consumers. Called during construction to set up the list of sub-consumers that will
|
protected getTokenParts(Iterator $tokens) : array Returns an array of IHeaderPart for the current token on the iterator. If the current token is a start token from a sub-consumer, the sub-
|
protected abstract getTokenSeparators() : array Returns an array of regular expression separators specific to this The returned patterns are used to split the header value into tokens for Each array element makes part of a generated regular expression that is
|
protected getTokenSplitPattern() : string Returns a regex pattern used to split the input header string. The default implementation calls
|
protected abstract isEndToken(string $token) : bool Returns true if the passed string token marks the end marker for the
|
protected abstract isStartToken(string $token) : bool Returns true if the passed string token marks the beginning marker for
|
protected parseTokensIntoParts(Iterator $tokens) : array Iterates over the passed token Iterator and returns an array of parsed The method checks each token to see if the token matches a sub-consumer's If a sub-consumer's start token is matched, the sub-consumer is invoked After all tokens are read and an array of Header\Parts are constructed,
|
protected processParts(array $parts) : array Performs any final processing on the array of parsed parts before The default implementation simply returns the passed array after
|
protected splitRawValue( $rawValue) : array Returns an array of split tokens from the input string. The method calls preg_split using
|
Methods |
private parseRawValue(string $value) : array Parses the raw header value into header parts. Calls splitTokens to split the value into token part strings, then calls
|
Methods |
public static getInstance(ZBateson Returns the singleton instance for the class. |