Holds a running value for an RFC-2231 split header parameter.

ParameterConsumer creates SplitParameterTokens when a split header parameter is first found, and adds subsequent split parts to an already created one if the parameter name matches.

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

 Methods

Initializes a SplitParameterToken.

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

Parameters

$charsetConverter

\ZBateson\MbWrapper\MbWrapper

$name

string

the parameter's name

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

Adds the passed part to the running array of values.

addPart(string $value, boolean $isEncoded, integer $index) 

If $isEncoded is true, language and charset info is extracted from the value, and the value is decoded before returning in getValue.

The value of the parameter is sorted based on the passed $index arguments when adding before concatenating when re-constructing the value.

Parameters

$value

string

$isEncoded

boolean

$index

integer

Returns the language of the parameter if set, or null if not.

getLanguage() : string

Returns

string

Returns the name of the parameter.

getName() : string

Returns

string

Reconstructs the value of the split parameter into a single UTF-8 string and returns it.

getValue() : string
inherited_from \ZBateson\MailMimeParser\Header\Part\HeaderPart::getValue()

Returns

string

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

Extracts charset and language from an encoded value, setting them on the current object if $index is 0 and adds the value part to the encodedParts array.

extractMetaInformationAndValue(string $value, integer $index) 

Parameters

$value

string

$index

integer

Traverses $this->encodedParts until a non-sequential key is found, or the end of the array is found.

getNextEncodedValue() : string

This allows encoded parts of a split parameter to be split anywhere and reconstructed.

The returned string is converted to UTF-8 before being returned.

Returns

string

 Properties

 

charset of content in $encodedParts.

$charset : string

Default

'ISO-8859-1'
 

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

$charsetConverter : \ZBateson\MbWrapper\MbWrapper

Default

 

keeps encoded parts values that need to be decoded. Keys are set to the index part of the split parameter and used for sorting before decoding/concatenating.

$encodedParts : array<mixed,string>

Default

array()
 

RFC-1766 (or subset) language code with optional subtags, regions, etc...

$language : string

Default

 

contains literal parts that don't require any decoding (and are therefore ISO-8859-1 (technically should be 7bit US-ASCII but allowing 8bit shouldn't be an issue as elsewhere in MMP).

$literalParts : array<mixed,string>

Default

array()
 

name of the parameter.

$name : string

Default

 

the value of the part

$value : string

Default