Documentation

AddressList
in package

FinalYes

RFC 5322 address-list - a comma-separated collection of Address objects.

No group support - a group-shaped segment is treated as one opaque Address rather than parsed structurally.

Tags
category

Pop

author

Nick Sagona, III nick@popphp.org

copyright

Copyright (c) 2009-2026 Nick Sagona, III

license

https://www.popphp.org/license New BSD License

version
3.0.0

Table of Contents

Properties

$addresses  : array<string|int, Address>

Methods

__construct()  : mixed
__toString()  : string
addAddress()  : AddressList
count()  : int
getAddresses()  : array<string|int, Address>
parse()  : AddressList
Parse a comma-separated address list. Splits only on top-level commas - a comma inside a quoted display name is part of a QUOTED_STRING token, never a top-level delimiter, so it doesn't split the list. Never throws.
render()  : string
isGroupShaped()  : bool
A group ("display-name: mailbox-list;") is out of scope for this class - detected by a top-level ":" appearing before any top-level "<", AND a top-level ";" appearing somewhere after it (the group's closing terminator), and treated as one opaque, unparsed Address rather than being split on its internal commas. Both conditions are required - a bare unquoted ":" alone (e.g. a display name like "IT: Support" or "Ratio 3:1") is common in real-world addresses and must not be misdetected as a group.
spliceTokens()  : string

Properties

Methods

__construct()

public __construct([array<string|int, Address$addresses = [] ]) : mixed
Parameters
$addresses : array<string|int, Address> = []

__toString()

public __toString() : string
Return values
string

parse()

Parse a comma-separated address list. Splits only on top-level commas - a comma inside a quoted display name is part of a QUOTED_STRING token, never a top-level delimiter, so it doesn't split the list. Never throws.

public static parse(string $text) : AddressList
Parameters
$text : string
Return values
AddressList

render()

public render() : string
Return values
string

isGroupShaped()

A group ("display-name: mailbox-list;") is out of scope for this class - detected by a top-level ":" appearing before any top-level "<", AND a top-level ";" appearing somewhere after it (the group's closing terminator), and treated as one opaque, unparsed Address rather than being split on its internal commas. Both conditions are required - a bare unquoted ":" alone (e.g. a display name like "IT: Support" or "Ratio 3:1") is common in real-world addresses and must not be misdetected as a group.

protected static isGroupShaped(array<string|int, Token$tokens) : bool
Parameters
$tokens : array<string|int, Token>
Return values
bool

spliceTokens()

protected static spliceTokens(string $source, array<string|int, Token$tokens) : string
Parameters
$source : string
$tokens : array<string|int, Token>
Return values
string

        
On this page

Search results