TYPO3  7.6
Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes | List of all members
Swift_Mime_SimpleMimeEntity Class Reference
Inheritance diagram for Swift_Mime_SimpleMimeEntity:
Swift_Mime_MimeEntity Swift_Mime_CharsetObserver Swift_Mime_EncodingObserver Swift_Mime_Attachment Swift_Mime_MimePart Swift_Attachment Swift_Mime_EmbeddedFile Swift_Mime_SimpleMessage Swift_MimePart Swift_EmbeddedFile Swift_Message Swift_Image Swift_SignedMessage MailMessage

Public Member Functions

 __construct (Swift_Mime_HeaderSet $headers, Swift_Mime_ContentEncoder $encoder, Swift_KeyCache $cache, Swift_Mime_Grammar $grammar)
 
 generateId ()
 
 getHeaders ()
 
 getNestingLevel ()
 
 getContentType ()
 
 setContentType ($type)
 
 getId ()
 
 setId ($id)
 
 getDescription ()
 
 setDescription ($description)
 
 getMaxLineLength ()
 
 setMaxLineLength ($length)
 
 getChildren ()
 
 setChildren (array $children, $compoundLevel=null)
 
 getBody ()
 
 setBody ($body, $contentType=null)
 
 getEncoder ()
 
 setEncoder (Swift_Mime_ContentEncoder $encoder)
 
 getBoundary ()
 
 setBoundary ($boundary)
 
 charsetChanged ($charset)
 
 encoderChanged (Swift_Mime_ContentEncoder $encoder)
 
 toString ()
 
 __toString ()
 
 toByteStream (Swift_InputByteStream $is)
 
 __destruct ()
 
 __clone ()
 
- Public Member Functions inherited from Swift_Mime_MimeEntity
 setChildren (array $children)
 

Protected Member Functions

 _bodyToString ()
 
 _bodyToByteStream (Swift_InputByteStream $is)
 
 _getIdField ()
 
 _getHeaderFieldModel ($field)
 
 _setHeaderFieldModel ($field, $model)
 
 _getHeaderParameter ($field, $parameter)
 
 _setHeaderParameter ($field, $parameter, $value)
 
 _fixHeaders ()
 
 _getCache ()
 
 _getGrammar ()
 
 _clearCache ()
 
 getRandomId ()
 

Protected Attributes

 $_userContentType
 

Private Member Functions

 _readStream (Swift_OutputByteStream $os)
 
 _setEncoding ($encoding)
 
 _assertValidBoundary ($boundary)
 
 _setContentTypeInHeaders ($type)
 
 _setNestingLevel ($level)
 
 _getCompoundLevel ($children)
 
 _getNeededChildLevel ($child, $compoundLevel)
 
 _createChild ()
 
 _notifyEncoderChanged (Swift_Mime_ContentEncoder $encoder)
 
 _notifyCharsetChanged ($charset)
 
 _sortChildren ()
 
 _childSortAlgorithm ($a, $b)
 
 _assertValidId ($id)
 

Private Attributes

 $_headers
 
 $_body
 
 $_encoder
 
 $_grammar
 
 $_boundary
 
 $_compositeRanges
 
 $_compoundLevelFilters = array()
 
 $_nestingLevel = self::LEVEL_ALTERNATIVE
 
 $_cache
 
 $_immediateChildren = array()
 
 $_children = array()
 
 $_maxLineLength = 78
 
 $_alternativePartOrder
 
 $_id
 
 $_cacheKey
 

Additional Inherited Members

- Public Attributes inherited from Swift_Mime_MimeEntity
const LEVEL_TOP = 16
 
const LEVEL_MIXED = 256
 
const LEVEL_ALTERNATIVE = 4096
 
const LEVEL_RELATED = 65536
 

Detailed Description

A MIME entity, in a multipart message.

Author
Chris Corbyn

Definition at line 16 of file SimpleMimeEntity.php.

Constructor & Destructor Documentation

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

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

Parameters
Swift_Mime_HeaderSet$headers
Swift_Mime_ContentEncoder$encoder
Swift_KeyCache$cache
Swift_Mime_Grammar$grammar

Definition at line 81 of file SimpleMimeEntity.php.

References getRandomId(), and setEncoder().

__destruct ( )

Empties it's own contents from the cache.

Definition at line 828 of file SimpleMimeEntity.php.

Member Function Documentation

__clone ( )

Make a deep copy of object.

Definition at line 856 of file SimpleMimeEntity.php.

References $_encoder, $_headers, and setChildren().

__toString ( )

Returns a string representation of this object.

See Also
toString()
Returns
string

Definition at line 517 of file SimpleMimeEntity.php.

References toString().

_assertValidBoundary (   $boundary)
private

Definition at line 717 of file SimpleMimeEntity.php.

Referenced by setBoundary().

_assertValidId (   $id)
private

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

Parameters
string$id
Exceptions
Swift_RfcComplianceException

Definition at line 840 of file SimpleMimeEntity.php.

Referenced by getRandomId().

_bodyToByteStream ( Swift_InputByteStream  $is)
protected
_bodyToString ( )
protected

Get this entire entity as a string.

Returns
string

Definition at line 481 of file SimpleMimeEntity.php.

References getBody(), getMaxLineLength(), and Swift_KeyCache\MODE_WRITE.

Referenced by toString().

_childSortAlgorithm (   $a,
  $b 
)
private

Definition at line 807 of file SimpleMimeEntity.php.

_clearCache ( )
protected

Empty the KeyCache for this entity.

Definition at line 673 of file SimpleMimeEntity.php.

Referenced by setBody(), Swift_Mime_MimePart\setCharset(), and setEncoder().

_createChild ( )
private

Definition at line 768 of file SimpleMimeEntity.php.

References $_cache, $_encoder, and $_grammar.

Referenced by setChildren().

_fixHeaders ( )
protected

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

Definition at line 637 of file SimpleMimeEntity.php.

References _setEncoding(), _setHeaderParameter(), and getBoundary().

Referenced by setChildren().

_getCache ( )
protected

Get the KeyCache used in this entity.

Returns
Swift_KeyCache

Definition at line 655 of file SimpleMimeEntity.php.

References $_cache.

Referenced by Swift_Mime_SimpleMessage\_becomeMimePart().

_getCompoundLevel (   $children)
private

Definition at line 738 of file SimpleMimeEntity.php.

Referenced by setChildren().

_getGrammar ( )
protected

Get the grammar used for validation.

Returns
Swift_Mime_Grammar

Definition at line 665 of file SimpleMimeEntity.php.

References $_grammar.

Referenced by Swift_Mime_SimpleMessage\_becomeMimePart().

_getHeaderFieldModel (   $field)
protected
_getHeaderParameter (   $field,
  $parameter 
)
protected
_getIdField ( )
protected

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

Definition at line 581 of file SimpleMimeEntity.php.

Referenced by getId(), and setId().

_getNeededChildLevel (   $child,
  $compoundLevel 
)
private

Definition at line 748 of file SimpleMimeEntity.php.

Referenced by setChildren().

_notifyCharsetChanged (   $charset)
private

Definition at line 781 of file SimpleMimeEntity.php.

Referenced by charsetChanged().

_notifyEncoderChanged ( Swift_Mime_ContentEncoder  $encoder)
private

Definition at line 774 of file SimpleMimeEntity.php.

Referenced by encoderChanged(), and setEncoder().

_readStream ( Swift_OutputByteStream  $os)
private
_setContentTypeInHeaders (   $type)
private

Definition at line 726 of file SimpleMimeEntity.php.

References _setHeaderFieldModel().

Referenced by setChildren(), and setContentType().

_setEncoding (   $encoding)
private

Definition at line 710 of file SimpleMimeEntity.php.

References _setHeaderFieldModel().

Referenced by _fixHeaders(), and setEncoder().

_setHeaderFieldModel (   $field,
  $model 
)
protected
_setHeaderParameter (   $field,
  $parameter,
  $value 
)
protected
_setNestingLevel (   $level)
private

Definition at line 733 of file SimpleMimeEntity.php.

_sortChildren ( )
private

Definition at line 790 of file SimpleMimeEntity.php.

Referenced by setChildren().

charsetChanged (   $charset)

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

Parameters
string$charset

Implements Swift_Mime_CharsetObserver.

Definition at line 447 of file SimpleMimeEntity.php.

References _notifyCharsetChanged().

encoderChanged ( Swift_Mime_ContentEncoder  $encoder)

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

Parameters
Swift_Mime_ContentEncoder$encoder

Implements Swift_Mime_EncodingObserver.

Definition at line 458 of file SimpleMimeEntity.php.

References _notifyEncoderChanged().

generateId ( )

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

Returns
string

Definition at line 120 of file SimpleMimeEntity.php.

References $_id, getRandomId(), and setId().

getBody ( )

Get the body of this entity as a string.

Returns
string

Implements Swift_Mime_MimeEntity.

Definition at line 350 of file SimpleMimeEntity.php.

References $_body, and _readStream().

Referenced by _bodyToString(), and Swift_Signers_SMimeSigner\createMessage().

getBoundary ( )

Get the boundary used to separate children in this entity.

Returns
string

Definition at line 415 of file SimpleMimeEntity.php.

References $_boundary.

Referenced by _bodyToByteStream(), and _fixHeaders().

getChildren ( )

Get all children added to this entity.

Returns
Swift_Mime_MimeEntity[]

Implements Swift_Mime_MimeEntity.

Definition at line 268 of file SimpleMimeEntity.php.

References $_children.

Referenced by Swift_Mime_MimePart\_fixHeaders(), and Swift_Signers_SMimeSigner\createMessage().

getContentType ( )

Get the Content-type of this entity.

Returns
string

Implements Swift_Mime_MimeEntity.

Definition at line 154 of file SimpleMimeEntity.php.

References _getHeaderFieldModel().

Referenced by Swift_Signers_SMimeSigner\createMessage().

getDescription ( )

Get the description of this entity.

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

Returns
string

Definition at line 214 of file SimpleMimeEntity.php.

References _getHeaderFieldModel().

getEncoder ( )

Get the encoder used for the body of this entity.

Returns
Swift_Mime_ContentEncoder

Definition at line 385 of file SimpleMimeEntity.php.

References $_encoder.

Referenced by Swift_Mime_SimpleMessage\_becomeMimePart().

getHeaders ( )
getId ( )

Get the CID of this entity.

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

Returns
string

Implements Swift_Mime_MimeEntity.

Definition at line 183 of file SimpleMimeEntity.php.

References $_id, _getHeaderFieldModel(), and _getIdField().

Referenced by Swift_Mime_EmbeddedFile\__construct().

getMaxLineLength ( )

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

Returns
int

Definition at line 242 of file SimpleMimeEntity.php.

References $_maxLineLength.

Referenced by _bodyToByteStream(), and _bodyToString().

getNestingLevel ( )

Get the nesting level of this entity.

See Also
LEVEL_TOP, LEVEL_MIXED, LEVEL_RELATED, LEVEL_ALTERNATIVE
Returns
int

Implements Swift_Mime_MimeEntity.

Definition at line 144 of file SimpleMimeEntity.php.

References $_nestingLevel.

getRandomId ( )
protected

Returns a random Content-ID or Message-ID.

Returns
string

Definition at line 683 of file SimpleMimeEntity.php.

References _assertValidId().

Referenced by __construct(), and generateId().

setBody (   $body,
  $contentType = null 
)

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

Parameters
mixed$body
string$contentTypeoptional
Returns
Swift_Mime_SimpleMimeEntity

Implements Swift_Mime_MimeEntity.

Definition at line 366 of file SimpleMimeEntity.php.

References _clearCache(), and setContentType().

Referenced by Swift_Attachment\__construct(), Swift_EmbeddedFile\__construct(), and Swift_Mime_Attachment\setFile().

setBoundary (   $boundary)

Set the boundary used to separate children in this entity.

Parameters
string$boundary
Exceptions
Swift_RfcComplianceException
Returns
Swift_Mime_SimpleMimeEntity

Definition at line 433 of file SimpleMimeEntity.php.

References _assertValidBoundary().

Referenced by Swift_Signers_SMimeSigner\streamToMime().

setChildren ( array  $children,
  $compoundLevel = null 
)

Set all children of this entity.

Parameters
Swift_Mime_MimeEntity[]$children
int$compoundLevelFor internal use only
Returns
Swift_Mime_SimpleMimeEntity

Definition at line 281 of file SimpleMimeEntity.php.

References $_userContentType, _createChild(), _fixHeaders(), _getCompoundLevel(), _getNeededChildLevel(), _setContentTypeInHeaders(), _sortChildren(), and elseif.

Referenced by __clone(), Swift_Signers_SMimeSigner\createMessage(), and Swift_Signers_SMimeSigner\signMessage().

setContentType (   $type)
setDescription (   $description)

Set the description of this entity.

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

Parameters
string$description
Returns
Swift_Mime_SimpleMimeEntity

Definition at line 228 of file SimpleMimeEntity.php.

References _setHeaderFieldModel().

setEncoder ( Swift_Mime_ContentEncoder  $encoder)

Set the encoder used for the body of this entity.

Parameters
Swift_Mime_ContentEncoder$encoder
Returns
Swift_Mime_SimpleMimeEntity

Definition at line 397 of file SimpleMimeEntity.php.

References _clearCache(), _notifyEncoderChanged(), _setEncoding(), and Swift_Mime_ContentEncoder\getName().

Referenced by __construct(), and Swift_Signers_SMimeSigner\signMessage().

setId (   $id)

Set the CID of this entity.

Parameters
string$id
Returns
Swift_Mime_SimpleMimeEntity

Definition at line 197 of file SimpleMimeEntity.php.

References _getIdField(), and _setHeaderFieldModel().

Referenced by Swift_Mime_EmbeddedFile\__construct(), Swift_Mime_SimpleMessage\__construct(), and generateId().

setMaxLineLength (   $length)

Set the maximum line length of lines in this body.

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

Parameters
int$length
Returns
Swift_Mime_SimpleMimeEntity

Definition at line 256 of file SimpleMimeEntity.php.

toByteStream ( Swift_InputByteStream  $is)

Write this entire entity to a {

See Also
Swift_InputByteStream}.
Parameters
Swift_InputByteStream

Implements Swift_Mime_MimeEntity.

Definition at line 527 of file SimpleMimeEntity.php.

References _bodyToByteStream(), Swift_InputByteStream\commit(), and Swift_InputByteStream\write().

toString ( )

Get this entire entity as a string.

Returns
string

Implements Swift_Mime_MimeEntity.

Definition at line 468 of file SimpleMimeEntity.php.

References _bodyToString().

Referenced by __toString().

Member Data Documentation

$_alternativePartOrder
private
Initial value:
= array(
'text/plain' => 1,
'text/html' => 2,
'multipart/related' => 3,
)

The order in which alternative mime types should appear

Definition at line 59 of file SimpleMimeEntity.php.

$_body
private

The body as a string, or a stream

Definition at line 22 of file SimpleMimeEntity.php.

Referenced by getBody().

$_boundary
private

A mime boundary, if any is used

Definition at line 31 of file SimpleMimeEntity.php.

Referenced by getBoundary().

$_cache
private

A KeyCache instance used during encoding and streaming

Definition at line 47 of file SimpleMimeEntity.php.

Referenced by _createChild(), and _getCache().

$_cacheKey
private

The key used for accessing the cache

Definition at line 69 of file SimpleMimeEntity.php.

$_children = array()
private

All descendants of this entity

Definition at line 53 of file SimpleMimeEntity.php.

Referenced by getChildren().

$_compositeRanges
private
Initial value:
= array(
'multipart/mixed' => array(self::LEVEL_TOP, self::LEVEL_MIXED),
'multipart/alternative' => array(self::LEVEL_MIXED, self::LEVEL_ALTERNATIVE),
'multipart/related' => array(self::LEVEL_ALTERNATIVE, self::LEVEL_RELATED),
)

Mime types to be used based on the nesting level

Definition at line 34 of file SimpleMimeEntity.php.

$_compoundLevelFilters = array()
private

A set of filter rules to define what level an entity should be nested at

Definition at line 41 of file SimpleMimeEntity.php.

$_encoder
private

The encoder that encodes the body into a streamable format

Definition at line 25 of file SimpleMimeEntity.php.

Referenced by __clone(), _createChild(), and getEncoder().

$_grammar
private

The grammar to use for id validation

Definition at line 28 of file SimpleMimeEntity.php.

Referenced by _createChild(), and _getGrammar().

$_headers
private

A collection of Headers for this mime entity

Definition at line 19 of file SimpleMimeEntity.php.

Referenced by __clone(), and getHeaders().

$_id
private

The CID of this entity

Definition at line 66 of file SimpleMimeEntity.php.

Referenced by generateId(), and getId().

$_immediateChildren = array()
private

Direct descendants of this entity

Definition at line 50 of file SimpleMimeEntity.php.

$_maxLineLength = 78
private

The maximum line length of the body of this entity

Definition at line 56 of file SimpleMimeEntity.php.

Referenced by getMaxLineLength().

$_nestingLevel = self::LEVEL_ALTERNATIVE
private

The nesting level of this entity

Definition at line 44 of file SimpleMimeEntity.php.

Referenced by getNestingLevel().

$_userContentType
protected

Definition at line 71 of file SimpleMimeEntity.php.

Referenced by setChildren().