Documentation

Swift_Mime_Attachment extends Swift_Mime_SimpleMimeEntity
in package

An attachment, in a multipart message.

Tags
author

Chris Corbyn

Table of Contents

LEVEL_ALTERNATIVE  = 4096
An entity which nests with the same precedence as a mime part
LEVEL_MIXED  = 256
An entity which nests with the same precedence as an attachment
LEVEL_RELATED  = 65536
An entity which nests with the same precedence as embedded content
LEVEL_TOP  = 16
Main message document; there can only be one of these
$userContentType  : mixed
$alternativePartOrder  : mixed
The order in which alternative mime types should appear
$body  : mixed
The body as a string, or a stream
$boundary  : mixed
A mime boundary, if any is used
$cache  : mixed
A KeyCache instance used during encoding and streaming
$cacheKey  : mixed
The key used for accessing the cache
$children  : mixed
All descendants of this entity
$compositeRanges  : mixed
Mime types to be used based on the nesting level
$compoundLevelFilters  : mixed
A set of filter rules to define what level an entity should be nested at
$encoder  : mixed
The encoder that encodes the body into a streamable format
$headers  : mixed
A collection of Headers for this mime entity
$id  : mixed
The CID of this entity
$idGenerator  : mixed
Message ID generator
$immediateChildren  : mixed
Direct descendants of this entity
$maxLineLength  : mixed
The maximum line length of the body of this entity
$mimeTypes  : mixed
Recognized MIME types
$nestingLevel  : mixed
The nesting level of this entity
__clone()  : mixed
Make a deep copy of object.
__construct()  : mixed
Create a new Attachment with $headers, $encoder and $cache.
__destruct()  : mixed
Empties it's own contents from the cache.
__toString()  : string
Returns a string representation of this object.
charsetChanged()  : mixed
Receive notification that the charset of this entity, or a parent entity has changed.
encoderChanged()  : mixed
Receive notification that the encoder of this entity or a parent entity has changed.
generateId()  : string
Generate a new Content-ID or Message-ID for this MIME entity.
getBody()  : string
Get the body of this entity as a string.
getBodyContentType()  : string
Get the Body Content-type of this entity.
getBoundary()  : string
Get the boundary used to separate children in this entity.
getChildren()  : array<string|int, Swift_Mime_SimpleMimeEntity>
Get all children added to this entity.
getContentType()  : string
Get the Content-type of this entity.
getDescription()  : string
Get the description of this entity.
getDisposition()  : string
Get the Content-Disposition of this attachment.
getEncoder()  : Swift_Mime_ContentEncoder
Get the encoder used for the body of this entity.
getFilename()  : string
Get the filename of this attachment when downloaded.
getHeaders()  : Swift_Mime_SimpleHeaderSet
Get the {@link Swift_Mime_SimpleHeaderSet} for this entity.
getId()  : string
Get the CID of this entity.
getMaxLineLength()  : int
Get the maximum line length of the body of this entity.
getNestingLevel()  : int
Get the nesting level used for this attachment.
getSize()  : int
Get the file size of this attachment.
setBody()  : $this
Set the body of this entity, either as a string, or as an instance of {@link Swift_OutputByteStream}.
setBoundary()  : $this
Set the boundary used to separate children in this entity.
setChildren()  : $this
Set all children of this entity.
setContentType()  : $this
Set the Content-type of this entity.
setDescription()  : $this
Set the description of this entity.
setDisposition()  : $this
Set the Content-Disposition of this attachment.
setEncoder()  : $this
Set the encoder used for the body of this entity.
setFile()  : $this
Set the file that this attachment is for.
setFilename()  : $this
Set the filename of this attachment.
setId()  : $this
Set the CID of this entity.
setMaxLineLength()  : $this
Set the maximum line length of lines in this body.
setSize()  : $this
Set the file size of this attachment.
toByteStream()  : mixed
Write this entire entity to a {@see Swift_InputByteStream}.
toString()  : string
Get this entire entity as a string.
bodyToByteStream()  : mixed
Write this entire entity to a {@link Swift_InputByteStream}.
bodyToString()  : string
Get this entire entity as a string.
clearCache()  : mixed
Empty the KeyCache for this entity.
fixHeaders()  : mixed
Re-evaluate what content type and encoding should be used on this entity.
getCache()  : Swift_KeyCache
Get the KeyCache used in this entity.
getHeaderFieldModel()  : mixed
Get the model data (usually an array or a string) for $field.
getHeaderParameter()  : mixed
Get the parameter value of $parameter on $field header.
getIdField()  : mixed
Get the name of the header that provides the ID of this entity.
getIdGenerator()  : Swift_IdGenerator
Get the ID generator.
setHeaderFieldModel()  : mixed
Set the model data for $field.
setHeaderParameter()  : mixed
Set the parameter value of $parameter on $field header.
assertValidBoundary()  : mixed
createChild()  : mixed
getCompoundLevel()  : mixed
getNeededChildLevel()  : mixed
notifyCharsetChanged()  : mixed
notifyEncoderChanged()  : mixed
readStream()  : mixed
setContentTypeInHeaders()  : mixed
setEncoding()  : mixed
setNestingLevel()  : mixed
sortChildren()  : mixed

Constants

LEVEL_ALTERNATIVE

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

public mixed LEVEL_ALTERNATIVE = 4096

LEVEL_MIXED

An entity which nests with the same precedence as an attachment

public mixed LEVEL_MIXED = 256

An entity which nests with the same precedence as embedded content

public mixed LEVEL_RELATED = 65536

LEVEL_TOP

Main message document; there can only be one of these

public mixed LEVEL_TOP = 16

Properties

$alternativePartOrder

The order in which alternative mime types should appear

private mixed $alternativePartOrder = ['text/plain' => 1, 'text/html' => 2, 'multipart/related' => 3]

$cache

A KeyCache instance used during encoding and streaming

private mixed $cache

$compositeRanges

Mime types to be used based on the nesting level

private mixed $compositeRanges = ['multipart/mixed' => [self::LEVEL_TOP, self::LEVEL_MIXED], 'multipart/alternative' => [self::LEVEL_MIXED, self::LEVEL_ALTERNATIVE], 'multipart/related' => [self::LEVEL_ALTERNATIVE, self::LEVEL_RELATED]]

$compoundLevelFilters

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

private mixed $compoundLevelFilters = []

$encoder

The encoder that encodes the body into a streamable format

private mixed $encoder

$headers

A collection of Headers for this mime entity

private mixed $headers

$immediateChildren

Direct descendants of this entity

private mixed $immediateChildren = []

$maxLineLength

The maximum line length of the body of this entity

private mixed $maxLineLength = 78

$mimeTypes

Recognized MIME types

private mixed $mimeTypes = []

$nestingLevel

The nesting level of this entity

private mixed $nestingLevel = self::LEVEL_ALTERNATIVE

Methods

__clone()

Make a deep copy of object.

public __clone() : mixed
Return values
mixed

__construct()

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

public __construct(Swift_Mime_SimpleHeaderSet $headers, Swift_Mime_ContentEncoder $encoder, Swift_KeyCache $cache, Swift_IdGenerator $idGenerator[, array<string|int, mixed> $mimeTypes = [] ]) : mixed
Parameters
$headers : Swift_Mime_SimpleHeaderSet
$encoder : Swift_Mime_ContentEncoder
$cache : Swift_KeyCache
$idGenerator : Swift_IdGenerator
$mimeTypes : array<string|int, mixed> = []
Return values
mixed

__destruct()

Empties it's own contents from the cache.

public __destruct() : mixed
Return values
mixed

__toString()

Returns a string representation of this object.

public __toString() : string
Tags
see
toString()
Return values
string

charsetChanged()

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

public charsetChanged(string $charset) : mixed
Parameters
$charset : string
Return values
mixed

generateId()

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

public generateId() : string
Return values
string

getBody()

Get the body of this entity as a string.

public getBody() : string
Return values
string

getBodyContentType()

Get the Body Content-type of this entity.

public getBodyContentType() : string
Return values
string

getBoundary()

Get the boundary used to separate children in this entity.

public getBoundary() : string
Return values
string

getContentType()

Get the Content-type of this entity.

public getContentType() : string
Return values
string

getDescription()

Get the description of this entity.

public getDescription() : string

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

Return values
string

getDisposition()

Get the Content-Disposition of this attachment.

public getDisposition() : string

By default attachments have a disposition of "attachment".

Return values
string

getFilename()

Get the filename of this attachment when downloaded.

public getFilename() : string
Return values
string

getId()

Get the CID of this entity.

public getId() : string

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

Return values
string

getMaxLineLength()

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

public getMaxLineLength() : int
Return values
int

getNestingLevel()

Get the nesting level used for this attachment.

public getNestingLevel() : int

Always returns .

Return values
int

getSize()

Get the file size of this attachment.

public getSize() : int
Return values
int

setBody()

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

public setBody(mixed $body[, string $contentType = null ]) : $this
Parameters
$body : mixed
$contentType : string = null

optional

Return values
$this

setBoundary()

Set the boundary used to separate children in this entity.

public setBoundary(string $boundary) : $this
Parameters
$boundary : string
Tags
throws
Swift_RfcComplianceException
Return values
$this

setContentType()

Set the Content-type of this entity.

public setContentType(string $type) : $this
Parameters
$type : string
Return values
$this

setDescription()

Set the description of this entity.

public setDescription(string $description) : $this

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

Parameters
$description : string
Return values
$this

setDisposition()

Set the Content-Disposition of this attachment.

public setDisposition(string $disposition) : $this
Parameters
$disposition : string
Return values
$this

setFile()

Set the file that this attachment is for.

public setFile(Swift_FileStream $file[, string $contentType = null ]) : $this
Parameters
$file : Swift_FileStream
$contentType : string = null

optional

Return values
$this

setFilename()

Set the filename of this attachment.

public setFilename(string $filename) : $this
Parameters
$filename : string
Return values
$this

setId()

Set the CID of this entity.

public setId(string $id) : $this
Parameters
$id : string
Return values
$this

setMaxLineLength()

Set the maximum line length of lines in this body.

public setMaxLineLength(int $length) : $this

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

Parameters
$length : int
Return values
$this

setSize()

Set the file size of this attachment.

public setSize(int $size) : $this
Parameters
$size : int
Return values
$this

toString()

Get this entire entity as a string.

public toString() : string
Return values
string

bodyToString()

Get this entire entity as a string.

protected bodyToString() : string
Return values
string

clearCache()

Empty the KeyCache for this entity.

protected clearCache() : mixed
Return values
mixed

fixHeaders()

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

protected fixHeaders() : mixed
Return values
mixed

getHeaderFieldModel()

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

protected getHeaderFieldModel(mixed $field) : mixed
Parameters
$field : mixed
Return values
mixed

getHeaderParameter()

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

protected getHeaderParameter(mixed $field, mixed $parameter) : mixed
Parameters
$field : mixed
$parameter : mixed
Return values
mixed

getIdField()

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

protected getIdField() : mixed
Return values
mixed

setHeaderFieldModel()

Set the model data for $field.

protected setHeaderFieldModel(mixed $field, mixed $model) : mixed
Parameters
$field : mixed
$model : mixed
Return values
mixed

setHeaderParameter()

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

protected setHeaderParameter(mixed $field, mixed $parameter, mixed $value) : mixed
Parameters
$field : mixed
$parameter : mixed
$value : mixed
Return values
mixed

assertValidBoundary()

private assertValidBoundary(mixed $boundary) : mixed
Parameters
$boundary : mixed
Return values
mixed

getCompoundLevel()

private getCompoundLevel(mixed $children) : mixed
Parameters
$children : mixed
Return values
mixed

getNeededChildLevel()

private getNeededChildLevel(mixed $child, mixed $compoundLevel) : mixed
Parameters
$child : mixed
$compoundLevel : mixed
Return values
mixed

notifyCharsetChanged()

private notifyCharsetChanged(mixed $charset) : mixed
Parameters
$charset : mixed
Return values
mixed

setContentTypeInHeaders()

private setContentTypeInHeaders(mixed $type) : mixed
Parameters
$type : mixed
Return values
mixed

setEncoding()

private setEncoding(mixed $encoding) : mixed
Parameters
$encoding : mixed
Return values
mixed

setNestingLevel()

private setNestingLevel(mixed $level) : mixed
Parameters
$level : mixed
Return values
mixed

Search results