FileAccess Orion

ParameterizedHeader extends UnstructuredHeader
in package

A Simple MIME Header.

Tags
author

Chris Corbyn

Table of Contents

PHRASE_PATTERN  = '(?:(?:(?:(?:(?:(?:(?:[ \\t]*(?:\\r\\n))?[ \\t])?(\\((?:(?:(?:[ \\t]*(?:\\r\\n))?[ \\t])|(?:(?:[\\x01-\\x08\\x0B\\x0C\\x0E-\\x19\\x7F]|[\\x21-\\x27\\x2A-\\x5B\\x5D-\\x7E])|(?:\\[\\x00-\\x08\\x0B\\x0C\\x0E-\\x7F])|(?1)))*(?:(?:[ \\t]*(?:\\r\\n))?[ \\t])?\\)))*(?:(?:(?:(?:[ \\t]*(?:\\r\\n))?[ \\t])?(\\((?:(?:(?:[ \\t]*(?:\\r\\n))?[ \\t])|(?:(?:[\\x01-\\x08\\x0B\\x0C\\x0E-\\x19\\x7F]|[\\x21-\\x27\\x2A-\\x5B\\x5D-\\x7E])|(?:\\[\\x00-\\x08\\x0B\\x0C\\x0E-\\x7F])|(?1)))*(?:(?:[ \\t]*(?:\\r\\n))?[ \\t])?\\)))|(?:(?:[ \\t]*(?:\\r\\n))?[ \\t])))?[a-zA-Z0-9!#\\$%&\'\\*\\+\\-\\/=\\?\\^_`\\{\\}\\|~]+(?:(?:(?:(?:[ \\t]*(?:\\r\\n))?[ \\t])?(\\((?:(?:(?:[ \\t]*(?:\\r\\n))?[ \\t])|(?:(?:[\\x01-\\x08\\x0B\\x0C\\x0E-\\x19\\x7F]|[\\x21-\\x27\\x2A-\\x5B\\x5D-\\x7E])|(?:\\[\\x00-\\x08\\x0B\\x0C\\x0E-\\x7F])|(?1)))*(?:(?:[ \\t]*(?:\\r\\n))?[ \\t])?\\)))*(?:(?:(?:(?:[ \\t]*(?:\\r\\n))?[ \\t])?(\\((?:(?:(?:[ \\t]*(?:\\r\\n))?[ \\t])|(?:(?:[\\x01-\\x08\\x0B\\x0C\\x0E-\\x19\\x7F]|[\\x21-\\x27\\x2A-\\x5B\\x5D-\\x7E])|(?:\\[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\\t]*(?:\\r\\n))?[ \\t])?(\\((?:(?:(?:[ \\t]*(?:\\r\\n))?[ \\t])|(?:(?:[\\x01-\\x08\\x0B\\x0C\\x0E-\\x19\\x7F]|[\\x21-\\x27\\x2A-\\x5B\\x5D-\\x7E])|(?:\\[\\x00-\\x08\\x0B\\x0C\\x0E-\\x7F])|(?1)))*(?:(?:[ \\t]*(?:\\r\\n))?[ \\t])?\\)))|(?:(?:[ \\t]*(?:\\r\\n))?[ \\t])))?))+?)'
TOKEN_REGEX  = '(?:[\\x21\\x23-\\x27\\x2A\\x2B\\x2D\\x2E\\x30-\\x39\\x41-\\x5A\\x5E-\\x7E]+)'
RFC 2231's definition of a token.
$charset  : mixed
$encoder  : mixed
$lang  : mixed
$lineLength  : mixed
$name  : mixed
$parameters  : mixed
$value  : mixed
__construct()  : mixed
getBody()  : string
getBodyAsString()  : string
Get the value of this header prepared for rendering.
getCharset()  : string|null
getLanguage()  : string|null
getMaxLineLength()  : int
getName()  : string
getParameter()  : string
getParameters()  : array<string|int, string>
getValue()  : string
Get the (unencoded) value of this header.
setBody()  : mixed
setCharset()  : mixed
setLanguage()  : mixed
Set the language used in this Header.
setMaxLineLength()  : mixed
setParameter()  : mixed
setParameters()  : mixed
setValue()  : mixed
Set the (unencoded) value of this header.
toString()  : string
Gets this Header rendered as a compliant string.
createPhrase()  : string
Produces a compliant, formatted RFC 2822 'phrase' based on the string given.
encodeWords()  : string
Encode needed word tokens within a string of input.
generateTokenLines()  : array<string|int, string>
Generates tokens from the given string which include CRLF as individual tokens.
getEncodableWordTokens()  : array<string|int, string>
Splits a string into tokens in blocks of words which can be encoded quickly.
getTokenAsEncodedWord()  : string
Get a token as an encoded word for safe insertion into headers.
tokenNeedsEncoding()  : bool
toTokens()  : array<string|int, mixed>
Generate a list of all tokens in the final header.
createParameter()  : string
Render a RFC 2047 compliant header parameter from the $name and $value.
getEndOfParameterValue()  : string
Returns the parameter value from the "=" and beyond.
tokensToString()  : string
Takes an array of tokens which appear in the header and turns them into an RFC 2822 compliant string, adding FWSP where needed.

Constants

PHRASE_PATTERN

public mixed PHRASE_PATTERN = '(?:(?:(?:(?:(?:(?:(?:[ \\t]*(?:\\r\\n))?[ \\t])?(\\((?:(?:(?:[ \\t]*(?:\\r\\n))?[ \\t])|(?:(?:[\\x01-\\x08\\x0B\\x0C\\x0E-\\x19\\x7F]|[\\x21-\\x27\\x2A-\\x5B\\x5D-\\x7E])|(?:\\[\\x00-\\x08\\x0B\\x0C\\x0E-\\x7F])|(?1)))*(?:(?:[ \\t]*(?:\\r\\n))?[ \\t])?\\)))*(?:(?:(?:(?:[ \\t]*(?:\\r\\n))?[ \\t])?(\\((?:(?:(?:[ \\t]*(?:\\r\\n))?[ \\t])|(?:(?:[\\x01-\\x08\\x0B\\x0C\\x0E-\\x19\\x7F]|[\\x21-\\x27\\x2A-\\x5B\\x5D-\\x7E])|(?:\\[\\x00-\\x08\\x0B\\x0C\\x0E-\\x7F])|(?1)))*(?:(?:[ \\t]*(?:\\r\\n))?[ \\t])?\\)))|(?:(?:[ \\t]*(?:\\r\\n))?[ \\t])))?[a-zA-Z0-9!#\\$%&\'\\*\\+\\-\\/=\\?\\^_`\\{\\}\\|~]+(?:(?:(?:(?:[ \\t]*(?:\\r\\n))?[ \\t])?(\\((?:(?:(?:[ \\t]*(?:\\r\\n))?[ \\t])|(?:(?:[\\x01-\\x08\\x0B\\x0C\\x0E-\\x19\\x7F]|[\\x21-\\x27\\x2A-\\x5B\\x5D-\\x7E])|(?:\\[\\x00-\\x08\\x0B\\x0C\\x0E-\\x7F])|(?1)))*(?:(?:[ \\t]*(?:\\r\\n))?[ \\t])?\\)))*(?:(?:(?:(?:[ \\t]*(?:\\r\\n))?[ \\t])?(\\((?:(?:(?:[ \\t]*(?:\\r\\n))?[ \\t])|(?:(?:[\\x01-\\x08\\x0B\\x0C\\x0E-\\x19\\x7F]|[\\x21-\\x27\\x2A-\\x5B\\x5D-\\x7E])|(?:\\[\\x00-\\x08\\x0B\\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[ \\t])?(\\((?:(?:(?:[ \\t]*(?:\\r\\n))?[ \\t])|(?:(?:[\\x01-\\x08\\x0B\\x0C\\x0E-\\x19\\x7F]|[\\x21-\\x27\\x2A-\\x5B\\x5D-\\x7E])|(?:\\[\\x00-\\x08\\x0B\\x0C\\x0E-\\x7F])|(?1)))*(?:(?:[ \\t]*(?:\\r\\n))?[ \\t])?\\)))|(?:(?:[ \\t]*(?:\\r\\n))?[ \\t])))?))+?)'

TOKEN_REGEX

RFC 2231's definition of a token.

public string TOKEN_REGEX = '(?:[\\x21\\x23-\\x27\\x2A\\x2B\\x2D\\x2E\\x30-\\x39\\x41-\\x5A\\x5E-\\x7E]+)'

Properties

Methods

__construct()

public __construct(string $name, string $value[, array<string|int, mixed> $parameters = [] ]) : mixed
Parameters
$name : string
$value : string
$parameters : array<string|int, mixed> = []
Return values
mixed

getBodyAsString()

Get the value of this header prepared for rendering.

public getBodyAsString() : string
Return values
string

getCharset()

public getCharset() : string|null
Return values
string|null

getLanguage()

public getLanguage() : string|null
Return values
string|null

getMaxLineLength()

public getMaxLineLength() : int
Return values
int

getParameter()

public getParameter(string $parameter) : string
Parameters
$parameter : string
Return values
string

getParameters()

public getParameters() : array<string|int, string>
Return values
array<string|int, string>

getValue()

Get the (unencoded) value of this header.

public getValue() : string
Return values
string

setBody()

public setBody(string $body) : mixed
Parameters
$body : string
Return values
mixed

setCharset()

public setCharset(string $charset) : mixed
Parameters
$charset : string
Return values
mixed

setLanguage()

Set the language used in this Header.

public setLanguage(string $lang) : mixed

For example, for US English, 'en-us'.

Parameters
$lang : string
Return values
mixed

setMaxLineLength()

public setMaxLineLength(int $lineLength) : mixed
Parameters
$lineLength : int
Return values
mixed

setParameter()

public setParameter(string $parameter, string|null $value) : mixed
Parameters
$parameter : string
$value : string|null
Return values
mixed

setParameters()

public setParameters(array<string|int, string> $parameters) : mixed
Parameters
$parameters : array<string|int, string>
Return values
mixed

setValue()

Set the (unencoded) value of this header.

public setValue(string $value) : mixed
Parameters
$value : string
Return values
mixed

toString()

Gets this Header rendered as a compliant string.

public toString() : string
Return values
string

createPhrase()

Produces a compliant, formatted RFC 2822 'phrase' based on the string given.

protected createPhrase(HeaderInterface $header, string $string, string $charset[, bool $shorten = false ]) : string
Parameters
$header : HeaderInterface
$string : string

as displayed

$charset : string
$shorten : bool = false

the first line to make remove for header name

Return values
string

encodeWords()

Encode needed word tokens within a string of input.

protected encodeWords(HeaderInterface $header, string $input[, int $usedLength = -1 ]) : string
Parameters
$header : HeaderInterface
$input : string
$usedLength : int = -1
Return values
string

generateTokenLines()

Generates tokens from the given string which include CRLF as individual tokens.

protected generateTokenLines(string $token) : array<string|int, string>
Parameters
$token : string
Return values
array<string|int, string>

getEncodableWordTokens()

Splits a string into tokens in blocks of words which can be encoded quickly.

protected getEncodableWordTokens(string $string) : array<string|int, string>
Parameters
$string : string
Return values
array<string|int, string>

getTokenAsEncodedWord()

Get a token as an encoded word for safe insertion into headers.

protected getTokenAsEncodedWord(string $token, int $firstLineOffset) : string
Parameters
$token : string
$firstLineOffset : int
Return values
string

tokenNeedsEncoding()

protected tokenNeedsEncoding(string $token) : bool
Parameters
$token : string
Return values
bool

toTokens()

Generate a list of all tokens in the final header.

protected toTokens([string $string = null ]) : array<string|int, mixed>

This doesn't need to be overridden in theory, but it is for implementation reasons to prevent potential breakage of attributes.

Parameters
$string : string = null
Return values
array<string|int, mixed>

createParameter()

Render a RFC 2047 compliant header parameter from the $name and $value.

private createParameter(string $name, string $value) : string
Parameters
$name : string
$value : string
Return values
string

getEndOfParameterValue()

Returns the parameter value from the "=" and beyond.

private getEndOfParameterValue(string $value[, bool $encoded = false ][, bool $firstLine = false ]) : string
Parameters
$value : string

to append

$encoded : bool = false
$firstLine : bool = false
Return values
string

tokensToString()

Takes an array of tokens which appear in the header and turns them into an RFC 2822 compliant string, adding FWSP where needed.

private tokensToString(array<string|int, string> $tokens) : string
Parameters
$tokens : array<string|int, string>
Return values
string

Search results