PHP Class Swift_Mime_Headers_AbstractHeader, Halite

Author: Chris Corbyn
Inheritance: implements Swift_Mime_Header
Show file Open project: HaliteChallenge/Halite Class Usage Examples

Public Methods

Method Description
__construct ( Swift_Mime_Grammar $grammar ) Creates a new Header.
__toString ( ) : string Returns a string representation of this object.
getCharset ( ) : string Get the character set used in this Header.
getEncoder ( ) : Swift_Mime_HeaderEncoder Get the encoder used for encoding this Header.
getFieldName ( ) : string Get the name of this header (e.g. charset).
getGrammar ( ) : Swift_Mime_Grammar Get the grammar used for this Header.
getLanguage ( ) : string Get the language used in this Header.
getMaxLineLength ( ) : integer Get the maximum permitted length of lines in this Header.
setCharset ( string $charset ) Set the character set used in this Header.
setEncoder ( Swift_Mime_HeaderEncoder $encoder ) Set the encoder used for encoding the header.
setGrammar ( Swift_Mime_Grammar $grammar ) Set the grammar used for the header.
setLanguage ( string $lang ) Set the language used in this Header.
setMaxLineLength ( integer $lineLength ) Set the maximum length of lines in the header (excluding EOL).
toString ( ) : string Get this Header rendered as a RFC 2822 compliant string.

Protected Methods

Method Description
clearCachedValueIf ( boolean $condition ) Clear the cached value if $condition is met.
createPhrase ( Swift_Mime_Header $header, string $string, string $charset, Swift_Mime_HeaderEncoder $encoder = null, boolean $shorten = false ) : string Produces a compliant, formatted RFC 2822 'phrase' based on the string given.
encodeWords ( Swift_Mime_Header $header, string $input, string $usedLength ) : string Encode needed word tokens within a string of input.
generateTokenLines ( string $token ) : string[] Generates tokens from the given string which include CRLF as individual tokens.
getCachedValue ( ) : string Get the value in the cache.
getEncodableWordTokens ( string $string ) : string[] Splits a string into tokens in blocks of words which can be encoded quickly.
getTokenAsEncodedWord ( string $token, integer $firstLineOffset ) : string Get a token as an encoded word for safe insertion into headers.
setCachedValue ( string $value ) Set a value into the cache.
setFieldName ( string $name ) Set the name of this Header field.
toTokens ( string $string = null ) : array Generate a list of all tokens in the final header.
tokenNeedsEncoding ( string $token ) : boolean Test if a token needs to be encoded or not.

Private Methods

Method Description
_tokensToString ( array $tokens ) : string Takes an array of tokens which appear in the header and turns them into an RFC 2822 compliant string, adding FWSP where needed.

Method Details

__construct() public method

Creates a new Header.
public __construct ( Swift_Mime_Grammar $grammar )
$grammar Swift_Mime_Grammar

__toString() public method

Returns a string representation of this object.
See also: toString()
public __toString ( ) : string
return string

clearCachedValueIf() protected method

Clear the cached value if $condition is met.
protected clearCachedValueIf ( boolean $condition )
$condition boolean

createPhrase() protected method

Produces a compliant, formatted RFC 2822 'phrase' based on the string given.
protected createPhrase ( Swift_Mime_Header $header, string $string, string $charset, Swift_Mime_HeaderEncoder $encoder = null, boolean $shorten = false ) : string
$header Swift_Mime_Header
$string string as displayed
$charset string of the text
$encoder Swift_Mime_HeaderEncoder
$shorten boolean the first line to make remove for header name
return string

encodeWords() protected method

Encode needed word tokens within a string of input.
protected encodeWords ( Swift_Mime_Header $header, string $input, string $usedLength ) : string
$header Swift_Mime_Header
$input string
$usedLength string optional
return string

generateTokenLines() protected method

Generates tokens from the given string which include CRLF as individual tokens.
protected generateTokenLines ( string $token ) : string[]
$token string
return string[]

getCachedValue() protected method

Get the value in the cache.
protected getCachedValue ( ) : string
return string

getCharset() public method

Get the character set used in this Header.
public getCharset ( ) : string
return string

getEncodableWordTokens() protected method

Splits a string into tokens in blocks of words which can be encoded quickly.
protected getEncodableWordTokens ( string $string ) : string[]
$string string
return string[]

getEncoder() public method

Get the encoder used for encoding this Header.
public getEncoder ( ) : Swift_Mime_HeaderEncoder
return Swift_Mime_HeaderEncoder

getFieldName() public method

Get the name of this header (e.g. charset).
public getFieldName ( ) : string
return string

getGrammar() public method

Get the grammar used for this Header.
public getGrammar ( ) : Swift_Mime_Grammar
return Swift_Mime_Grammar

getLanguage() public method

Get the language used in this Header.
public getLanguage ( ) : string
return string

getMaxLineLength() public method

Get the maximum permitted length of lines in this Header.
public getMaxLineLength ( ) : integer
return integer

getTokenAsEncodedWord() protected method

Get a token as an encoded word for safe insertion into headers.
protected getTokenAsEncodedWord ( string $token, integer $firstLineOffset ) : string
$token string token to encode
$firstLineOffset integer optional
return string

setCachedValue() protected method

Set a value into the cache.
protected setCachedValue ( string $value )
$value string

setCharset() public method

Set the character set used in this Header.
public setCharset ( string $charset )
$charset string

setEncoder() public method

Set the encoder used for encoding the header.
public setEncoder ( Swift_Mime_HeaderEncoder $encoder )
$encoder Swift_Mime_HeaderEncoder

setFieldName() protected method

Set the name of this Header field.
protected setFieldName ( string $name )
$name string

setGrammar() public method

Set the grammar used for the header.
public setGrammar ( Swift_Mime_Grammar $grammar )
$grammar Swift_Mime_Grammar

setLanguage() public method

For example, for US English, 'en-us'. This can be unspecified.
public setLanguage ( string $lang )
$lang string

setMaxLineLength() public method

Set the maximum length of lines in the header (excluding EOL).
public setMaxLineLength ( integer $lineLength )
$lineLength integer

toString() public method

Get this Header rendered as a RFC 2822 compliant string.
public toString ( ) : string
return string

toTokens() protected method

Generate a list of all tokens in the final header.
protected toTokens ( string $string = null ) : array
$string string The string to tokenize
return array An array of tokens as strings

tokenNeedsEncoding() protected method

Test if a token needs to be encoded or not.
protected tokenNeedsEncoding ( string $token ) : boolean
$token string
return boolean