Copied!

Parses a header into a DateTime object.

CloneableInstantiable
Methods
public __construct(ZBateson\MbWrapper\MbWrapper $charsetConverter, string $token)
 

Tries parsing the passed token as an RFC 2822 date, and failing that into an RFC 822 date, and failing that, tries to parse it by calling new DateTime($value).

public ZBateson\MailMimeParser\Header\Part\HeaderPart::__toString() : string
 

Returns the value of the part (which is a string).

  • return string the value
public getDateTime() : ?DateTime
 

Returns a DateTime object or null if it can't be parsed.

  • return \DateTime
public ZBateson\MailMimeParser\Header\Part\HeaderPart::getValue() : ?string
 

Returns the part's value.

  • return ?string the value of the part
public ZBateson\MailMimeParser\Header\Part\HeaderPart::ignoreSpacesAfter() : bool
 

Returns true if spaces after this part should be ignored. True is only returned for MimeLiterals if the part ends with a mime-encoded string Tokens if the Token's value is a single space, and for CommentParts.

public ZBateson\MailMimeParser\Header\Part\HeaderPart::ignoreSpacesBefore() : bool
 

Returns true if spaces before this part should be ignored. True is only returned for MimeLiterals if the part begins with a mime-encoded string, Tokens if the Token's value is a single space, and for CommentParts.

Properties
protected ZBateson\MailMimeParser\Header\Part\HeaderPart::$charsetConverter = NULL
 
  • var \MbWrapper $charsetConverter the charset converter used for converting strings in HeaderPart::convertEncoding
protected $date = NULL
 
  • var \DateTime the parsed date, or null if the date could not be parsed
protected ZBateson\MailMimeParser\Header\Part\HeaderPart::$value = NULL
 
  • var string the value of the part
Methods
protected ZBateson\MailMimeParser\Header\Part\HeaderPart::convertEncoding(string $str, string $from = 'ISO-8859-1', bool $force = false) : string
 

Ensures the encoding of the passed string is set to UTF-8.

The method does nothing if the passed $from charset is UTF-8 already, or if $force is set to false and mb_check_encoding for $str returns true for 'UTF-8'.

  • return string utf-8 string
© 2024 Bruce Wells
Search Namespaces \ Classes
Configuration