An abstract base MIME Header.

package Swift
subpackage Mime
author Chris Corbyn

 Methods

Creates a new Header.

__construct(\Swift_Mime_Grammar $grammar) 

Parameters

Returns a string representation of this object.

__toString() : string
see \toString()

Returns

string

Get the character set used in this Header.

getCharset() : string

Returns

string

Get the encoder used for encoding this Header.

getEncoder() : \Swift_Mime_HeaderEncoder

Get the field body, prepared for folding into a final header value.

getFieldBody() : string
Inherited
inherited_from \Swift_Mime_Header::getFieldBody()

Returns

string

Get the model for the field body.

getFieldBodyModel() : mixed
Inherited

The return type depends on the specifics of the Header.

inherited_from \Swift_Mime_Header::getFieldBodyModel()

Returns

mixed

Get the name of this header (e.g.

getFieldName() : string

charset).

Returns

string

Get the type of Header that this instance represents.

getFieldType() : int
Inherited
see TYPE_PARAMETERIZED, TYPE_MAILBOX
see TYPE_ID, TYPE_PATH
inherited_from \Swift_Mime_Header::getFieldType()

Returns

int

Get the grammar used for this Header.

getGrammar() : \Swift_Mime_Grammar

Get the language used in this Header.

getLanguage() : string

Returns

string

Get the maximum permitted length of lines in this Header.

getMaxLineLength() : int

Returns

int

Set the character set used in this Header.

setCharset(string $charset) 

Parameters

$charset

string

Set the encoder used for encoding the header.

setEncoder(\Swift_Mime_HeaderEncoder $encoder) 

Parameters

Set the model for the field body.

setFieldBodyModel(mixed $model) 
Inherited

The actual types needed will vary depending upon the type of Header.

inherited_from \Swift_Mime_Header::setFieldBodyModel()

Parameters

$model

mixed

Set the grammar used for the header.

setGrammar(\Swift_Mime_Grammar $grammar) 

Parameters

Set the language used in this Header.

setLanguage(string $lang) 

For example, for US English, 'en-us'. This can be unspecified.

Parameters

$lang

string

Set the maximum length of lines in the header (excluding EOL).

setMaxLineLength(int $lineLength) 

Parameters

$lineLength

int

Get this Header rendered as a RFC 2822 compliant string.

toString() : string

Exceptions

\Swift_RfcComplianceException

Returns

string

Clear the cached value if $condition is met.

clearCachedValueIf(boolean $condition) 
access protected

Parameters

$condition

boolean

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

createPhrase(\Swift_Mime_Header $header, string $string, string $charset, \Swift_Mime_HeaderEncoder $encoder, boolean $shorten) : string

Parameters

$string

string

as displayed

$charset

string

of the text

$shorten

boolean

the first line to make remove for header name

Returns

string

Encode needed word tokens within a string of input.

encodeWords(\Swift_Mime_Header $header, string $input, $usedLength) : string

Parameters

$header

$input

string

$usedLength

Returns

string

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

generateTokenLines(string $token) : string[]
access protected

Parameters

$token

string

Returns

string[]

Get the value in the cache.

getCachedValue() : string
access protected

Returns

string

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

getEncodableWordTokens(string $string) : string[]

Parameters

$string

string

Returns

string[]

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

getTokenAsEncodedWord(string $token, $firstLineOffset) : string

Parameters

$token

string

to encode

$firstLineOffset

Returns

string

Set a value into the cache.

setCachedValue(string $value) 
access protected

Parameters

$value

string

Set the name of this Header field.

setFieldName(string $name) 
access protected

Parameters

$name

string

Generate a list of all tokens in the final header.

toTokens(string $string) : array
access protected

Parameters

$string

string

The string to tokenize

Returns

arrayAn array of tokens as strings

Test if a token needs to be encoded or not.

tokenNeedsEncoding(string $token) : boolean

Parameters

$token

string

Returns

boolean

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

_tokensToString(array $tokens) : string
access private

Parameters

$tokens

string[]

Returns

string

 Properties

 

$_cachedValue : string
access private
 

$_charset : string
access private
 

$_encoder : \Swift_Encoder
access private
 

$_grammar : \Swift_Mime_Grammar
access private
 

$_lang : string
 

$_lineLength : int
access private
 

$_name : string
access private

 Constants

 

Date and time headers

TYPE_DATE 
Inherited
inherited_from \Swift_Mime_Header::TYPE_DATE
 

Identification headers

TYPE_ID 
Inherited
inherited_from \Swift_Mime_Header::TYPE_ID
 

Mailbox and address headers

TYPE_MAILBOX 
Inherited
inherited_from \Swift_Mime_Header::TYPE_MAILBOX
 

Parameterized headers (text + params)

TYPE_PARAMETERIZED 
Inherited
inherited_from \Swift_Mime_Header::TYPE_PARAMETERIZED
 

Address path headers

TYPE_PATH 
Inherited
inherited_from \Swift_Mime_Header::TYPE_PATH
 

Text headers

TYPE_TEXT 
Inherited
inherited_from \Swift_Mime_Header::TYPE_TEXT