MailMimeParser 0.4

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 DateHeader: Date, Resent-Date, Delivery-Date, Expires, Expiry-Date, Reply-By ParameterHeader: Content-Type, Content-Disposition

Tags
author

Zaahid Bateson

Table of Contents

$consumerService  : ConsumerService
$genericType  : string
$types  : array<string|int, array<string|int, string>>
__construct()  : mixed
Instantiates member variables with the passed objects.
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

$genericType

protected string $genericType = 'ZBateson\MailMimeParser\Header\GenericHeader'

$types

protected array<string|int, array<string|int, string>> $types = ['ZBateson\MailMimeParser\Header\AddressHeader' => ['from', 'to', 'cc', 'bcc', 'sender', 'reply-to', 'resent-from', 'resent-to', 'resent-cc', 'resent-bcc', 'resent-reply-to'], 'ZBateson\MailMimeParser\Header\DateHeader' => ['date', 'resent-date', 'delivery-date', 'expires', 'expiry-date', 'reply-by'], 'ZBateson\MailMimeParser\Header\ParameterHeader' => ['content-type', 'content-disposition'], 'ZBateson\MailMimeParser\Header\SubjectHeader' => ['subject']]

Methods

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
Return values
string

Search results