Parses a header into a DateTime object.

author Zaahid Bateson
package MailMimeParser
inherited_from \ZBateson\MailMimeParser\Header\Part\LiteralPart

 Methods

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) ```.

__construct(\ZBateson\MbWrapper\MbWrapper $charsetConverter, string $token) 
inherited_from \ZBateson\MailMimeParser\Header\Part\LiteralPart::__construct()

Parameters

$charsetConverter

\ZBateson\MbWrapper\MbWrapper

$token

string

Sets up dependencies.

__construct(\ZBateson\MbWrapper\MbWrapper $charsetConverter) 
Inherited

Parameters

$charsetConverter

\ZBateson\MbWrapper\MbWrapper

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

__toString() : string
Inherited

Returns

stringthe value

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

getDateTime() : \DateTime

Returns

\DateTime

Returns the part's value.

getValue() : string
Inherited

Returns

stringthe value of the part

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.

ignoreSpacesAfter() : boolean
Inherited

Returns

boolean

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.

ignoreSpacesBefore() : boolean
Inherited

Returns

boolean

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

convertEncoding(string $str, string $from = 'ISO-8859-1', boolean $force = false) : string
Inherited

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'.

Parameters

$str

string

$from

string

$force

boolean

Returns

stringutf-8 string

 Properties

 

the charset converter used for converting strings in HeaderPart::convertEncoding

$charsetConverter : \ZBateson\MbWrapper\MbWrapper

Default

 

the parsed date, or null if the date could not be parsed

$date : \DateTime

Default

 

the value of the part

$value : string

Default