Abstract base class representing a mime email's header.
The base class sets up the header's consumer for parsing, sets the name of the header, and calls the consumer to parse the header's value.
- author Zaahid Bateson
Methods |
public __construct(Psr\Log\LoggerInterface $logger, ZBateson Assigns the header's name and raw value, then calls parseHeaderValue to extract a parsed value.
|
public __toString() : string |
public static from(string $nameOrLine, ?string $value = NULL) : ZBateson Parses the passed parameters into an IHeader object. The type of returned IHeader is determined by the name of the header. See {@see \HeaderFactory::newInstance} for more details. The required $nameOrLine parameter may contain either the name of a header to parse, or a full header line, e.g. From: email@example.com. If passing a full header line, the $value parameter must be set to null (the default). Note that more specific types can be called on directly. For instance an
AddressHeader may be created by calling AddressHeader::from() which will
ignore the name of the header, and always return an AddressHeader, or by
calling
|
public getAllParts() : array
|
public getComments() : array
|
public getErrorLoggingContextName() : string |
public getName() : string |
public getParts() : array
|
public getRawValue() : string |
public getValue() : ?string |
Properties |
protected array $allParts = []
|
protected string $name
|
protected array $parts = []
|
protected string $rawValue
|
Methods |
protected filterAndAssignToParts() : void Filters $this->allParts into the parts required by $this->parts and assigns it. The AbstractHeader::filterAndAssignToParts method filters out CommentParts. |
protected getErrorBagChildren() : array |
protected static getHeaderPartsFrom(string $nameOrLine, ?string $value = NULL) : array Checks if the passed $value parameter is null, and if so tries to parse a header line from $nameOrLine splitting on first occurrence of a ':' character. The returned array always contains two elements. The first being the name (or blank if a ':' char wasn't found and $value is null), and the second being the value.
|
protected parseHeaderValue(ZBateson Calls the consumer and assigns the parsed parts to member variables. The default implementation assigns the returned value to $this->allParts and filters out comments from it, assigning the filtered array to $this->parts by calling filterAndAssignToParts. |
protected validate() : void |
Properties |
private ?array $comments = NULL
|
Methods |
public static from(string $nameOrLine, ?string $value = NULL) : ZBateson Parses the passed parameters into an IHeader object. The type of returned IHeader is determined by the name of the header. See {@see \HeaderFactory::newInstance} for more details. The required $nameOrLine parameter may contain either the name of a header to parse, or a full header line, e.g. From: email@example.com. If passing a full header line, the $value parameter must be set to null (the default). Note that more specific types can be called on directly. For instance an
AddressHeader may be created by calling AddressHeader::from() which will
ignore the name of the header, and always return an AddressHeader, or by
calling
|
protected static getHeaderPartsFrom(string $nameOrLine, ?string $value = NULL) : array Checks if the passed $value parameter is null, and if so tries to parse a header line from $nameOrLine splitting on first occurrence of a ':' character. The returned array always contains two elements. The first being the name (or blank if a ':' char wasn't found and $value is null), and the second being the value.
|