A MIME entity, in a multipart message.

package Swift
subpackage Mime
author Chris Corbyn

 Methods

Create a new SimpleMimeEntity with $headers, $encoder and $cache.

__construct(\Swift_Mime_HeaderSet $headers, \Swift_Mime_ContentEncoder $encoder, \Swift_KeyCache $cache, \Swift_Mime_Grammar $grammar) 

Empties it's own contents from the cache.

__destruct() 

Returns a string representation of this object.

__toString() : string
see \toString()

Returns

string

Receive notification that the charset of this entity, or a parent entity has changed.

charsetChanged(string $charset) 

Parameters

$charset

string

Receive notification that the encoder of this entity or a parent entity has changed.

encoderChanged(\Swift_Mime_ContentEncoder $encoder) 

Parameters

Generate a new Content-ID or Message-ID for this MIME entity.

generateId() : string

Returns

string

Get the body of this entity as a string.

getBody() : string

Returns NULL if no body has been set.

Returns

string

Get the boundary used to separate children in this entity.

getBoundary() : string

Returns

string

Get all children added to this entity.

getChildren() : array

These are not just the immediate children, but all children.

Returns

arrayof Swift_Mime_Entity

Get the Content-type of this entity.

getContentType() : string

Returns

string

Get the description of this entity.

getDescription() : string

This value comes from the Content-Description header if set.

Returns

string

Get the encoder used for the body of this entity.

getEncoder() : \Swift_Mime_ContentEncoder

Get the {@link Swift_Mime_HeaderSet} for this entity.

getHeaders() : \Swift_Mime_HeaderSet

Get the CID of this entity.

getId() : string

The CID will only be present in headers if a Content-ID header is present.

Returns

string

Get the maximum line length of the body of this entity.

getMaxLineLength() : int

Returns

int

Get the nesting level of this entity.

getNestingLevel() : int

The lower the value, the more outermost the entity will be nested.

see LEVEL_MIXED, LEVEL_RELATED, LEVEL_ALTERNATIVE

Returns

int

Set the body of this entity, either as a string, or as an instance of {@link Swift_OutputByteStream}.

setBody(mixed $body, string $contentType) : \Swift_Mime_SimpleMimeEntity

Parameters

$body

mixed

$contentType

string

optional

Returns

Set the boundary used to separate children in this entity.

setBoundary(string $boundary) : \Swift_Mime_SimpleMimeEntity

Parameters

$boundary

string

Exceptions

\Swift_RfcComplianceException

Returns

Set all children of this entity.

setChildren(array $children, int $compoundLevel) : \Swift_Mime_SimpleMimeEntity

This includes grandchildren.

Parameters

$children

array

Swiift_Mime_Entity instances

$compoundLevel

int

For internal use only

Returns

Set the Content-type of this entity.

setContentType(string $type) : \Swift_Mime_SimpleMimeEntity

Parameters

$type

string

Returns

Set the description of this entity.

setDescription(string $description) : \Swift_Mime_SimpleMimeEntity

This method sets a value in the Content-ID header.

Parameters

$description

string

Returns

Set the encoder used for the body of this entity.

setEncoder(\Swift_Mime_ContentEncoder $encoder) : \Swift_Mime_SimpleMimeEntity

Set the CID of this entity.

setId(string $id) : \Swift_Mime_SimpleMimeEntity

Parameters

$id

string

Returns

Set the maximum line length of lines in this body.

setMaxLineLength(int $length) : \Swift_Mime_SimpleMimeEntity

Though not enforced by the library, lines should not exceed 1000 chars.

Parameters

$length

int

Returns

Write this entire entity to a {@link Swift_InputByteStream}.

toByteStream(\Swift_InputByteStream $is) 

Parameters

Get this entire entity as a string.

toString() : string

Returns

string

Empty the KeyCache for this entity.

_clearCache() 

Re-evaluate what content type and encoding should be used on this entity.

_fixHeaders() 

Get the KeyCache used in this entity.

_getCache() 

Get the grammar used for validation.

_getGrammar() : \Swift_Mime_Grammar

Get the model data (usually an array or a string) for $field.

_getHeaderFieldModel($field) 

Parameters

$field

Get the parameter value of $parameter on $field header.

_getHeaderParameter($field, $parameter) 

Parameters

$field

$parameter

Get the name of the header that provides the ID of this entity

_getIdField() 

Set the model data for $field.

_setHeaderFieldModel($field, $model) 

Parameters

$field

$model

Set the parameter value of $parameter on $field header.

_setHeaderParameter($field, $parameter, $value) 

Parameters

$field

$parameter

$value

Returns a random Content-ID or Message-ID.

getRandomId() : string

Returns

string

_assertValidBoundary()

_assertValidBoundary($boundary) 

Parameters

$boundary

Throws an Exception if the id passed does not comply with RFC 2822.

_assertValidId(string $id) 

Parameters

$id

string

Exceptions

\Swift_RfcComplianceException

_childSortAlgorithm()

_childSortAlgorithm($a, $b) 

Parameters

$a

$b

_createChild()

_createChild() 

_getCompoundLevel()

_getCompoundLevel($children) 

Parameters

$children

_getNeededChildLevel()

_getNeededChildLevel($child, $compoundLevel) 

Parameters

$child

$compoundLevel

_notifyCharsetChanged()

_notifyCharsetChanged($charset) 

Parameters

$charset

_notifyEncoderChanged()

_notifyEncoderChanged(\Swift_Mime_ContentEncoder $encoder) 

Parameters

$encoder

_readStream()

_readStream(\Swift_OutputByteStream $os) 

Parameters

$os

_setContentTypeInHeaders()

_setContentTypeInHeaders($type) 

Parameters

$type

_setEncoding()

_setEncoding($encoding) 

Parameters

$encoding

_setNestingLevel()

_setNestingLevel($level) 

Parameters

$level

_sortChildren()

_sortChildren() 

 Properties

 

$_userContentType 
 

$_alternativePartOrder 
 

$_body 
 

$_boundary 
 

$_cache 
 

$_cacheKey 
 

$_children 
 

$_compositeRanges 
 

$_compoundLevelFilters 
 

$_encoder 
 

$_grammar 
 

$_headers 
 

$_id 
 

$_immediateChildren 
 

$_maxLineLength 
 

$_nestingLevel 

 Constants

 

An entity which nests with the same precedence as a mime part

LEVEL_ALTERNATIVE 
Inherited
inherited_from \Swift_Mime_MimeEntity::LEVEL_ALTERNATIVE
 

An entity which nests with the same precedence as an attachment

LEVEL_MIXED 
Inherited
inherited_from \Swift_Mime_MimeEntity::LEVEL_MIXED
   

Main message document; there can only be one of these

LEVEL_TOP 
Inherited
inherited_from \Swift_Mime_MimeEntity::LEVEL_TOP