MailMimeParser 2.3

DatePart extends LiteralPart
in package

Parses a header into a DateTime object.

Tags
author

Zaahid Bateson

Table of Contents

$charsetConverter  : MbWrapper
$date  : DateTime
$value  : string
__construct()  : mixed
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).
__toString()  : string
Returns the value of the part (which is a string).
getDateTime()  : DateTime
Returns a DateTime object or null if it can't be parsed.
getValue()  : string|null
Returns the part's value.
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.
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.
convertEncoding()  : string
Ensures the encoding of the passed string is set to UTF-8.

Properties

$charsetConverter

protected MbWrapper $charsetConverter

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

$date

protected DateTime $date = null

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

$value

protected string $value

the value of the part

Methods

__construct()

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 __construct(MbWrapper $charsetConverter, string $token) : mixed
Parameters
$charsetConverter : MbWrapper
$token : string
Return values
mixed

__toString()

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

public __toString() : string
Return values
string

the value

getDateTime()

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

public getDateTime() : DateTime
Return values
DateTime

getValue()

Returns the part's value.

public getValue() : string|null
Return values
string|null

the value of the part

ignoreSpacesAfter()

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 ignoreSpacesAfter() : bool
Return values
bool

ignoreSpacesBefore()

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.

public ignoreSpacesBefore() : bool
Return values
bool

convertEncoding()

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

protected convertEncoding(string $str[, string $from = 'ISO-8859-1' ][, bool $force = false ]) : string

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 = 'ISO-8859-1'
$force : bool = false
Return values
string

utf-8 string

Search results