Holds a string value token that will require additional processing by a consumer prior to returning to a client.

A Token is meant to hold a value for further processing -- for instance when consuming an address list header (like From or To) -- before it's known what type of HeaderPart it is (could be an email address, could be a name, or could be a group.)

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

 Methods

Initializes a token.

__construct(\ZBateson\MbWrapper\MbWrapper $charsetConverter, string $value) 
inherited_from \ZBateson\MailMimeParser\Header\Part\HeaderPart::__construct()

Parameters

$charsetConverter

\ZBateson\MbWrapper\MbWrapper

$value

string

the token's value

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 the part's value.

getValue() : string
Inherited

Returns

stringthe value of the part

Returns true if the value is a space.

ignoreSpacesAfter() : boolean
inherited_from \ZBateson\MailMimeParser\Header\Part\HeaderPart::ignoreSpacesAfter()

Returns

boolean

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 the value is a space.

ignoreSpacesBefore() : boolean
inherited_from \ZBateson\MailMimeParser\Header\Part\HeaderPart::ignoreSpacesBefore()

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

Returns true if the value of the token is equal to a single space.

isSpace() : boolean

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 value of the part

$value : string

Default