Holds a group of addresses, and an optional group name.

Because AddressGroupConsumer is only called once a colon (":") character is found, an AddressGroupPart is initially constructed without a $name. Once it is returned to AddressConsumer, a new AddressGroupPart is created out of AddressGroupConsumer's AddressGroupPart.

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

 Methods

Creates an AddressGroupPart out of the passed array of AddressParts and an optional name (which may be mime-encoded).

__construct(\ZBateson\MbWrapper\MbWrapper $charsetConverter, array<mixed,\ZBateson\MailMimeParser\Header\Part\AddressPart> $addresses, string $name = ''
inherited_from \ZBateson\MailMimeParser\Header\Part\MimeLiteralPart::__construct()

Parameters

$charsetConverter

\ZBateson\MbWrapper\MbWrapper

$addresses

array<mixed,\ZBateson\MailMimeParser\Header\Part\AddressPart>

$name

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 the AddressPart at the passed index or null.

getAddress(integer $index) : \ZBateson\MailMimeParser\Header\Part\Address

Parameters

$index

integer

Returns

\ZBateson\MailMimeParser\Header\Part\Address

Return the AddressGroupPart's array of addresses.

getAddresses() : array<mixed,\ZBateson\MailMimeParser\Header\Part\AddressPart>

Returns

array<mixed,\ZBateson\MailMimeParser\Header\Part\AddressPart>

Returns an array of parts mapped to languages in the header value, for instance the string:

getLanguageArray() : array<mixed,string[]>
Inherited

'Hello and =?UTF-8fr-be?Q?bonjour_?= =?UTF-8it?Q?mi amici?=. Welcome!'

Would be mapped in the returned array as follows:

[
    0 => [ 'lang' => null, 'value' => 'Hello and ' ],
    1 => [ 'lang' => 'fr-be', 'value' => 'bonjour ' ],
    3 => [ 'lang' => 'it', 'value' => 'mi amici' ],
    4 => [ 'lang' => null, 'value' => ' Weolcome!' ]
]

Returns

array<mixed,string[]>

Returns the name of the group

getName() : string

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

Adds the passed part into the languages array with the given language.

addToLanguage(string $part, string|null $language = null
Inherited

Parameters

$part

string

$language

stringnull

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

Finds and replaces mime parts with their values.

decodeMime(string $value) : string
Inherited

The method splits the token value into an array on mime-part-patterns, either replacing a mime part with its value by calling iconv_mime_decode or converts the encoding on the text part by calling convertEncoding.

Parameters

$value

string

Returns

string

Decodes a matched mime entity part into a string and returns it, after adding the string into the languages array.

decodeMatchedEntity(array<mixed,string> $matches) : string
Inherited

Parameters

$matches

array<mixed,string>

Returns

string

Decodes a single mime-encoded entity.

decodeSplitPart(string $entity) : string
Inherited

Unfortunately, mb_decode_header fails for many charsets on PHP 5.4 and PHP 5.5 (even if they're listed as supported). iconv_mime_decode doesn't support all charsets.

Parsing out the charset and body of the encoded entity seems to be the way to go to support the most charsets.

Parameters

$entity

string

Returns

string

 Properties

 

an array of AddressParts

$addresses : array<mixed,\ZBateson\MailMimeParser\Header\Part\AddressPart>

Default

 

set to true to ignore spaces after this part

$canIgnoreSpacesAfter : boolean

Default

false
 

set to true to ignore spaces before this part

$canIgnoreSpacesBefore : boolean

Default

false
 

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

$charsetConverter : \ZBateson\MbWrapper\MbWrapper

Default

 

maintains an array mapping rfc1766 language tags to parts of text in the value.

$languages : array

Default

array()
 

the value of the part

$value : string

Default

 Constants

 

<p>regex pattern matching a mime-encoded part</p>

MIME_PART_PATTERN = '=\?[^?=]+\?[QBqb]\?[^\?]+\?=' : string
 

<p>regex pattern used when parsing parameterized headers</p>

MIME_PART_PATTERN_NO_QUOTES = '=\?[^\?=]+\?[QBqb]\?[^\?"]+\?=' : string