Copied!

Constructs various IHeader 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:

  • {@see \AddressHeader}: From, To, Cc, Bcc, Sender, Reply-To, Resent-From, Resent-To, Resent-Cc, Resent-Bcc, Resent-Reply-To, Return-Path, Delivered-To
  • {@see \DateHeader}: Date, Resent-Date, Delivery-Date, Expires, Expiry-Date, Reply-By
  • {@see \ParameterHeader}: Content-Type, Content-Disposition, Received-SPF, Authentication-Results, DKIM-Signature, Autocrypt
  • {@see \SubjectHeader}: Subject
  • {@see \IdHeader}: Message-ID, Content-ID, In-Reply-To, References
  • {@see \ReceivedHeader}: Received
CloneableInstantiable
Methods
public __construct(Psr\Log\LoggerInterface $logger, ZBateson\MailMimeParser\Header\Part\MimeTokenPartFactory $mimeTokenPartFactory, ZBateson\MailMimeParser\Header\Consumer\AddressBaseConsumerService $addressBaseConsumerService, ZBateson\MailMimeParser\Header\Consumer\DateConsumerService $dateConsumerService, ZBateson\MailMimeParser\Header\Consumer\GenericConsumerMimeLiteralPartService $genericConsumerMimeLiteralPartService, ZBateson\MailMimeParser\Header\Consumer\IdBaseConsumerService $idBaseConsumerService, ZBateson\MailMimeParser\Header\Consumer\ParameterConsumerService $parameterConsumerService, ZBateson\MailMimeParser\Header\Consumer\ReceivedConsumerService $receivedConsumerService, ZBateson\MailMimeParser\Header\Consumer\SubjectConsumerService $subjectConsumerService)
public getNormalizedHeaderName(string $header) : string
 

Returns the string in lower-case, and with non-alphanumeric characters stripped out.

  • param string $header The header name
  • return string The normalized header name
public newInstance(string $name, string $value) : ZBateson\MailMimeParser\Header\IHeader
 

Creates an IHeader instance for the passed header name and value, and returns it.

  • param string $name The header name.
  • param string $value The header value.
  • return \IHeader The created header object.
public newInstanceOf(string $name, string $value, string $iHeaderClass) : ZBateson\MailMimeParser\Header\IHeader
 

Creates an IHeader instance for the passed header name and value using the passed IHeader class, and returns it.

  • param string $name The header name.
  • param string $value The header value.
  • param string $iHeaderClass The class to use for header creation
  • return \IHeader The created header object.
Properties
protected array $consumerServices
 
  • var \IConsumerService[] array of available consumer service classes
protected $genericType = 'ZBateson\MailMimeParser\Header\GenericHeader'
 
  • var string Defines the generic IHeader type to use for headers that aren't mapped in $types
protected Psr\Log\LoggerInterface $logger
protected ZBateson\MailMimeParser\Header\Part\MimeTokenPartFactory $mimeTokenPartFactory
 
  • var \MimeTokenPartFactory for mime decoding.
protected $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', 'receivedspf', 'authenticationresults', 'dkimsignature', 'autocrypt'], 'ZBateson\MailMimeParser\Header\SubjectHeader' => ['subject'], 'ZBateson\MailMimeParser\Header\IdHeader' => ['messageid', 'contentid', 'inreplyto', 'references'], 'ZBateson\MailMimeParser\Header\ReceivedHeader' => ['received']]
 
  • var string[][] maps IHeader types to headers.
Methods
private getClassFor(string $name) : string
 

Returns the name of an IHeader class for the passed header name.

  • param string $name The header name.
  • return string The Fully Qualified class name.
© 2024 Bruce Wells
Search Namespaces \ Classes
Configuration