PHP Class Swift_Mime_SimpleHeaderSet

Author: Chris Corbyn
Inheritance: implements Swift_Mime_HeaderSet
Show file Open project: swiftmailer/swiftmailer Class Usage Examples

Public Methods

Method Description
__clone ( ) Make a deep copy of object.
__construct ( Swift_Mime_HeaderFactory $factory, string $charset = null ) Create a new SimpleHeaderSet with the given $factory.
__toString ( ) : string Returns a string representation of this object.
addDateHeader ( string $name, DateTimeInterface $dateTime = null ) Add a new Date header using $dateTime.
addIdHeader ( string $name, string | array $ids = null ) Add a new ID header for Message-ID or Content-ID.
addMailboxHeader ( string $name, array | string $addresses = null ) Add a new Mailbox Header with a list of $addresses.
addParameterizedHeader ( string $name, string $value = null, array $params = [] ) Add a new ParameterizedHeader with $name, $value and $params.
addPathHeader ( string $name, string $path = null ) Add a new Path header with an address (path) in it.
addTextHeader ( string $name, string $value = null ) Add a new basic text header with $name and $value.
charsetChanged ( string $charset ) Notify this observer that the entity's charset has changed.
defineOrdering ( array $sequence ) Define a list of Header names as an array in the correct order.
get ( string $name, integer $index ) : Swift_Mime_Header Get the header with the given $name.
getAll ( string $name = null ) : array Get all headers with the given $name.
has ( string $name, integer $index ) : boolean Returns true if at least one header with the given $name exists.
listAll ( ) : array Return the name of all Headers.
newInstance ( )
remove ( string $name, integer $index ) Remove the header with the given $name if it's set.
removeAll ( string $name ) Remove all headers with the given $name.
set ( Swift_Mime_Header $header, integer $index ) Set a header in the HeaderSet.
setAlwaysDisplayed ( array $names ) Set a list of header names which must always be displayed when set.
setCharset ( string $charset ) Set the charset used by these headers.
toString ( ) : string Returns a string with a representation of all headers.

Private Methods

Method Description
canSort ( ) Test if the headers can be sorted
isDisplayed ( Swift_Mime_Header $header ) Test if the given Header is always displayed
notifyHeadersOfCharset ( $charset ) Notify all Headers of the new charset
sortHeaders ( $a, $b ) uksort() algorithm for Header ordering
storeHeader ( $name, Swift_Mime_Header $header, $offset = null ) Save a Header to the internal collection

Method Details

__clone() public method

Make a deep copy of object.
public __clone ( )

__construct() public method

Create a new SimpleHeaderSet with the given $factory.
public __construct ( Swift_Mime_HeaderFactory $factory, string $charset = null )
$factory Swift_Mime_HeaderFactory
$charset string

__toString() public method

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

addDateHeader() public method

Add a new Date header using $dateTime.
public addDateHeader ( string $name, DateTimeInterface $dateTime = null )
$name string
$dateTime DateTimeInterface

addIdHeader() public method

Add a new ID header for Message-ID or Content-ID.
public addIdHeader ( string $name, string | array $ids = null )
$name string
$ids string | array

addMailboxHeader() public method

Add a new Mailbox Header with a list of $addresses.
public addMailboxHeader ( string $name, array | string $addresses = null )
$name string
$addresses array | string

addParameterizedHeader() public method

Add a new ParameterizedHeader with $name, $value and $params.
public addParameterizedHeader ( string $name, string $value = null, array $params = [] )
$name string
$value string
$params array

addPathHeader() public method

Add a new Path header with an address (path) in it.
public addPathHeader ( string $name, string $path = null )
$name string
$path string

addTextHeader() public method

Add a new basic text header with $name and $value.
public addTextHeader ( string $name, string $value = null )
$name string
$value string

charsetChanged() public method

Notify this observer that the entity's charset has changed.
public charsetChanged ( string $charset )
$charset string

defineOrdering() public method

These Headers will be output in the given order where present.
public defineOrdering ( array $sequence )
$sequence array

get() public method

If multiple headers match, the actual one may be specified by $index. Returns NULL if none present.
public get ( string $name, integer $index ) : Swift_Mime_Header
$name string
$index integer
return Swift_Mime_Header

getAll() public method

Get all headers with the given $name.
public getAll ( string $name = null ) : array
$name string
return array

has() public method

If multiple headers match, the actual one may be specified by $index.
public has ( string $name, integer $index ) : boolean
$name string
$index integer
return boolean

listAll() public method

Return the name of all Headers.
public listAll ( ) : array
return array

newInstance() public method

public newInstance ( )

remove() public method

If multiple headers match, the actual one may be specified by $index.
public remove ( string $name, integer $index )
$name string
$index integer

removeAll() public method

Remove all headers with the given $name.
public removeAll ( string $name )
$name string

set() public method

The header may be a previously fetched header via {@link get()} or it may be one that has been created separately. If $index is specified, the header will be inserted into the set at this offset.
public set ( Swift_Mime_Header $header, integer $index )
$header Swift_Mime_Header
$index integer

setAlwaysDisplayed() public method

Usually headers without a field value won't be output unless set here.
public setAlwaysDisplayed ( array $names )
$names array

setCharset() public method

Set the charset used by these headers.
public setCharset ( string $charset )
$charset string

toString() public method

Returns a string with a representation of all headers.
public toString ( ) : string
return string