HeaderFactory
Constructs various AbstractHeader types depending on the type of header passed.
If the passed header resolves to a specific defined header type, it is parsed as such. Otherwise, a GenericHeader is instantiated and returned. Headers are mapped as follows:
AddressHeader: From, To, Cc, Bcc, Sender, Reply-To, Resent-From, Resent-To, Resent-Cc, Resent-Bcc, Resent-Reply-To, Delivered-To, Return-Path DateHeader: Date, Resent-Date, Delivery-Date, Expires, Expiry-Date, Reply-By ParameterHeader: Content-Type, Content-Disposition IdHeader: Message-ID, Content-ID, In-Reply-To, References ReceivedHeader: Received
Tags
Table of Contents
- $consumerService : ConsumerService
- $genericType : string
- $mimeLiteralPartFactory : MimeLiteralPartFactory
- $types : array<string|int, array<string|int, string>>
- __construct() : mixed
- Instantiates member variables with the passed objects.
- getNormalizedHeaderName() : string
- Returns the string in lower-case, and with non-alphanumeric characters stripped out.
- newHeaderContainer() : mixed
- Creates and returns a HeaderContainer.
- newInstance() : AbstractHeader
- Creates an AbstractHeader instance for the passed header name and value, and returns it.
- getClassFor() : string
- Returns the name of an AbstractHeader class for the passed header name.
Properties
$consumerService
protected
ConsumerService
$consumerService
$genericType
protected
string
$genericType
= 'ZBateson\MailMimeParser\Header\GenericHeader'
$mimeLiteralPartFactory
protected
MimeLiteralPartFactory
$mimeLiteralPartFactory
$types
protected
array<string|int, array<string|int, string>>
$types
= ['ZBateson\MailMimeParser\Header\AddressHeader' => ['from', 'to', 'cc', 'bcc', 'sender', 'replyto', 'resentfrom', 'resentto', 'resentcc', 'resentbcc', 'resentreplyto', 'returnpath', 'deliveredto'], 'ZBateson\MailMimeParser\Header\DateHeader' => ['date', 'resentdate', 'deliverydate', 'expires', 'expirydate', 'replyby'], 'ZBateson\MailMimeParser\Header\ParameterHeader' => ['contenttype', 'contentdisposition'], 'ZBateson\MailMimeParser\Header\SubjectHeader' => ['subject'], 'ZBateson\MailMimeParser\Header\IdHeader' => ['messageid', 'contentid', 'inreplyto', 'references'], 'ZBateson\MailMimeParser\Header\ReceivedHeader' => ['received']]
Methods
__construct()
Instantiates member variables with the passed objects.
public
__construct(ConsumerService $consumerService, MimeLiteralPartFactory $mimeLiteralPartFactory) : mixed
Parameters
- $consumerService : ConsumerService
- $mimeLiteralPartFactory : MimeLiteralPartFactory
Return values
mixed —getNormalizedHeaderName()
Returns the string in lower-case, and with non-alphanumeric characters stripped out.
public
getNormalizedHeaderName(string $header) : string
Parameters
- $header : string
Return values
string —newHeaderContainer()
Creates and returns a HeaderContainer.
public
newHeaderContainer() : mixed
Return values
mixed —newInstance()
Creates an AbstractHeader instance for the passed header name and value, and returns it.
public
newInstance(string $name, string $value) : AbstractHeader
Parameters
- $name : string
- $value : string
Return values
AbstractHeader —getClassFor()
Returns the name of an AbstractHeader class for the passed header name.
private
getClassFor(string $name) : string
Parameters
- $name : string