Value
in package
MIME part header value class
Tags
Table of Contents
Constants
- ADDRESS_HEADER_NAMES = ['to', 'from', 'cc', 'bcc', 'reply-to', 'sender', 'resent-to', 'resent-from', 'resent-cc', 'resent-bcc', 'resent-sender']
- Header names whose value is a structured address (mailbox-list or address-list per RFC 5322) - for these, the value is parsed via AddressList and each address's display name is RFC 2047-encoded independently, never the address itself. Groups and obs-* forms aren't parsed structurally - see AddressList::parse().
Properties
- $delimiter : string
- Header value delimiter
- $forceQuote : bool
- Force quotes for parameter values
- $parameters : array<string|int, mixed>
- Header value parameters
- $scheme : string|null
- Header value scheme
- $value : string|null
- Header value
Methods
- __construct() : mixed
- Constructor
- __toString() : string
- Render the header value string
- addParameter() : Value
- Set a header value parameter
- addParameters() : Value
- Add the header value parameters
- getDecodedValue() : string|null
- Get the header value, decoded of any RFC 2047 encoded-words
- getDelimiter() : string
- Get the header value delimiter
- getParameter() : string|null
- Get a header value parameter
- getParameters() : array<string|int, mixed>
- Get the header value parameters
- getParametersAsString() : string
- Get the header value parameters as string
- getScheme() : string|null
- Get the header value scheme
- getValue() : string|null
- Get the header value
- hasDelimiter() : bool
- Has a header value delimiter
- hasParameter() : bool
- Has a header value parameter
- hasParameters() : bool
- Has header value parameters
- hasScheme() : bool
- Has a header value scheme
- isForceQuote() : bool
- Is set to force quote
- parse() : Value
- Parse header value
- parseParameter() : array<string|int, mixed>
- Parse a parameter value
- render() : string
- Render the header value string
- setDelimiter() : Value
- Set the header value delimiter
- setForceQuote() : Value
- Set the header value delimiter
- setScheme() : Value
- Set the header value scheme
- setValue() : Value
- Set the header value
- encodeValueForHeader() : string
- isInsideEncodedWord() : bool
- renderSegment() : string
- Concatenate a token list's values back into a string
- spliceSegment() : string
- Splice a token span's exact original text out of the source string, by first/last token offset - preserves comments, escapes, and whitespace exactly as written, unlike reconstructing from token values.
- trimFws() : array<string|int, Token>
- Trim leading/trailing FWS tokens from a token list
Constants
ADDRESS_HEADER_NAMES
Header names whose value is a structured address (mailbox-list or address-list per RFC 5322) - for these, the value is parsed via AddressList and each address's display name is RFC 2047-encoded independently, never the address itself. Groups and obs-* forms aren't parsed structurally - see AddressList::parse().
protected
array<string|int, mixed>
ADDRESS_HEADER_NAMES
= ['to', 'from', 'cc', 'bcc', 'reply-to', 'sender', 'resent-to', 'resent-from', 'resent-cc', 'resent-bcc', 'resent-sender']
Properties
$delimiter
Header value delimiter
protected
string
$delimiter
= ';'
$forceQuote
Force quotes for parameter values
protected
bool
$forceQuote
= false
$parameters
Header value parameters
protected
array<string|int, mixed>
$parameters
= []
$scheme
Header value scheme
protected
string|null
$scheme
= null
$value
Header value
protected
string|null
$value
= null
Methods
__construct()
Constructor
public
__construct([string|null $value = null ][, string|null $scheme = null ][, array<string|int, mixed> $parameters = [] ][, bool $forceQuote = false ]) : mixed
Instantiate the header value object
Parameters
- $value : string|null = null
- $scheme : string|null = null
- $parameters : array<string|int, mixed> = []
- $forceQuote : bool = false
__toString()
Render the header value string
public
__toString() : string
Return values
stringaddParameter()
Set a header value parameter
public
addParameter(string $name, string $value) : Value
Parameters
- $name : string
- $value : string
Return values
ValueaddParameters()
Add the header value parameters
public
addParameters(array<string|int, mixed> $parameters) : Value
Parameters
- $parameters : array<string|int, mixed>
Return values
ValuegetDecodedValue()
Get the header value, decoded of any RFC 2047 encoded-words
public
getDecodedValue() : string|null
Return values
string|nullgetDelimiter()
Get the header value delimiter
public
getDelimiter() : string
Return values
stringgetParameter()
Get a header value parameter
public
getParameter(string $name) : string|null
Parameters
- $name : string
Return values
string|nullgetParameters()
Get the header value parameters
public
getParameters() : array<string|int, mixed>
Return values
array<string|int, mixed>getParametersAsString()
Get the header value parameters as string
public
getParametersAsString() : string
Tags
Return values
stringgetScheme()
Get the header value scheme
public
getScheme() : string|null
Return values
string|nullgetValue()
Get the header value
public
getValue() : string|null
Return values
string|nullhasDelimiter()
Has a header value delimiter
public
hasDelimiter() : bool
Return values
boolhasParameter()
Has a header value parameter
public
hasParameter(string $name) : bool
Parameters
- $name : string
Return values
boolhasParameters()
Has header value parameters
public
hasParameters() : bool
Return values
boolhasScheme()
Has a header value scheme
public
hasScheme() : bool
Return values
boolisForceQuote()
Is set to force quote
public
isForceQuote() : bool
Return values
boolparse()
Parse header value
public
static parse(string $value) : Value
Parameters
- $value : string
Return values
ValueparseParameter()
Parse a parameter value
public
static parseParameter(string $parameter) : array<string|int, mixed>
Parameters
- $parameter : string
Return values
array<string|int, mixed>render()
Render the header value string
public
render([string|null $headerName = null ]) : string
Parameters
- $headerName : string|null = null
Tags
Return values
stringsetDelimiter()
Set the header value delimiter
public
setDelimiter(string $delimiter) : Value
Parameters
- $delimiter : string
Return values
ValuesetForceQuote()
Set the header value delimiter
public
setForceQuote([bool $forceQuote = false ]) : Value
Parameters
- $forceQuote : bool = false
Return values
ValuesetScheme()
Set the header value scheme
public
setScheme(string $scheme) : Value
Parameters
- $scheme : string
Return values
ValuesetValue()
Set the header value
public
setValue(string $value) : Value
Parameters
- $value : string
Return values
ValueencodeValueForHeader()
protected
static encodeValueForHeader(string $value, string|null $headerName) : string
Parameters
- $value : string
- $headerName : string|null
Return values
stringisInsideEncodedWord()
protected
static isInsideEncodedWord(Token $token, array<string|int, mixed> $ranges) : bool
Parameters
- $token : Token
- $ranges : array<string|int, mixed>
Return values
boolrenderSegment()
Concatenate a token list's values back into a string
protected
static renderSegment(array<string|int, Token> $tokens) : string
Parameters
- $tokens : array<string|int, Token>
Return values
stringspliceSegment()
Splice a token span's exact original text out of the source string, by first/last token offset - preserves comments, escapes, and whitespace exactly as written, unlike reconstructing from token values.
protected
static spliceSegment(string $source, array<string|int, Token> $tokens) : string
Parameters
- $source : string
- $tokens : array<string|int, Token>
Return values
stringtrimFws()
Trim leading/trailing FWS tokens from a token list
protected
static trimFws(array<string|int, Token> $tokens) : array<string|int, Token>
Parameters
- $tokens : array<string|int, Token>