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.

public __construct(ZBateson\MbWrapper\MbWrapper $charsetConverter, $name)

Initializes a SplitParameterToken.

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

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

public addPart( $value, $isEncoded, $index)

Adds the passed part to the running array of values.

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

public getLanguage()

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

public getName()

Returns the name of the parameter.

public getValue()

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

public ZBateson\MailMimeParser\Header\Part\HeaderPart::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 ZBateson\MailMimeParser\Header\Part\HeaderPart::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.

protected $charset
protected ZBateson\MailMimeParser\Header\Part\HeaderPart::$charsetConverter
protected $encodedParts
  • var phpDocumentor\Reflection\Types\Array_ 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.
protected $language
protected $literalParts
  • var phpDocumentor\Reflection\Types\Array_ 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).
protected $name
protected ZBateson\MailMimeParser\Header\Part\HeaderPart::$value
protected ZBateson\MailMimeParser\Header\Part\HeaderPart::convertEncoding( $str, $from = 'ISO-8859-1', $force = false)

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

protected extractMetaInformationAndValue( $value, $index)

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

private getNextEncodedValue()

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

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

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

© 2023 Bruce Wells
Search Namespaces \ Classes