Public Member Functions | Protected Member Functions | Protected Attributes

Zend_Mail_Part Class Reference

Inheritance diagram for Zend_Mail_Part:
Zend_Mail_Part_Interface Zend_Mail_Message Zend_Mail_Part_File Zend_Mail_Message_File

Public Member Functions

 __construct (array $params)
 isMultipart ()
 getContent ()
 getSize ()
 getPart ($num)
 countParts ()
 getHeaders ()
 getHeader ($name, $format=null)
 headerExists ($name)
 getHeaderField ($name, $wantedPart=0, $firstName=0)
 __get ($name)
 __isset ($name)
 __toString ()
 hasChildren ()
 getChildren ()
 valid ()
 next ()
 key ()
 current ()
 rewind ()

Protected Member Functions

 _cacheContent ()

Protected Attributes

 $_headers
 $_content
 $_topLines = ''
 $_parts = array()
 $_countParts
 $_iterationPos = 1
 $_mail
 $_messageNum = 0

Detailed Description

Definition at line 40 of file Part.php.


Constructor & Destructor Documentation

__construct ( array $  params )

Public constructor

Zend_Mail_Part supports different sources for content. The possible params are:

  • handler a instance of Zend_Mail_Storage_Abstract for late fetch
  • id number of message for handler
  • raw raw content with header and body as string
  • headers headers as array (name => value) or string, if a content part is found it's used as toplines
  • noToplines ignore content found after headers in param 'headers'
  • content content as string
Parameters:
array$paramsfull message with or without headers
Exceptions:
Zend_Mail_Exception

See also:
Zend_Mail_Exception
Zend_Mail_Exception

Reimplemented in Zend_Mail_Message_File, Zend_Mail_Message, and Zend_Mail_Part_File.

Definition at line 104 of file Part.php.


Member Function Documentation

__get ( name )

Getter for mail headers - name is matched in lowercase

This getter is short for Zend_Mail_Part::getHeader($name, 'string')

See also:
Zend_Mail_Part::getHeader()
Parameters:
string$nameheader name
Returns:
string value of header
Exceptions:
Zend_Mail_Exception

Implements Zend_Mail_Part_Interface.

Definition at line 416 of file Part.php.

__isset ( name )

Isset magic method proxy to hasHeader

This method is short syntax for Zend_Mail_Part::hasHeader($name);

See also:
Zend_Mail_Part::hasHeader
Parameters:
string
Returns:
boolean

Definition at line 431 of file Part.php.

__toString (  )

magic method to get content of part

Returns:
string content

Implements Zend_Mail_Part_Interface.

Definition at line 441 of file Part.php.

_cacheContent (  ) [protected]

Cache content and split in parts if multipart

Returns:
null
Exceptions:
Zend_Mail_Exception

See also:
Zend_Mail_Exception

Definition at line 202 of file Part.php.

countParts (  )

Count parts of a multipart part

Returns:
int number of sub-parts

Implements Zend_Mail_Part_Interface.

Definition at line 276 of file Part.php.

current (  )

implements Iterator::current()

Returns:
Zend_Mail_Part current part

Definition at line 505 of file Part.php.

getChildren (  )

implements RecursiveIterator::getChildren()

Returns:
Zend_Mail_Part same as self::current()

Definition at line 462 of file Part.php.

getContent (  )

Body of part

If part is multipart the raw content of this part with all sub parts is returned

Returns:
string body
Exceptions:
Zend_Mail_Exception

See also:
Zend_Mail_Exception

Implements Zend_Mail_Part_Interface.

Definition at line 167 of file Part.php.

getHeader ( name,
format = null 
)

Get a header in specificed format

Internally headers that occur more than once are saved as array, all other as string. If $format is set to string implode is used to concat the values (with Zend_Mime::LINEEND as delim).

Parameters:
string$namename of header, matches case-insensitive, but camel-case is replaced with dashes
string$formatchange type of return value to 'string' or 'array'
Returns:
string|array value of header in wanted or internal format
Exceptions:
Zend_Mail_Exception

See also:
Zend_Mail_Exception

Implements Zend_Mail_Part_Interface.

Definition at line 332 of file Part.php.

getHeaderField ( name,
wantedPart = 0,
firstName = 0 
)

Get a specific field from a header like content type or all fields as array

If the header occurs more than once, only the value from the first header is returned.

Throws a Zend_Mail_Exception if the requested header does not exist. If the specific header field does not exist, returns null.

Parameters:
string$namename of header, like in getHeader()
string$wantedPartthe wanted part, default is first, if null an array with all parts is returned
string$firstNamekey name for the first part
Returns:
string|array wanted part or all parts as array($firstName => firstPart, partname => value)
Exceptions:
Zend_Exception,Zend_Mail_Exception

Implements Zend_Mail_Part_Interface.

Definition at line 400 of file Part.php.

getHeaders (  )

Get all headers

The returned headers are as saved internally. All names are lowercased. The value is a string or an array if a header with the same name occurs more than once.

Returns:
array headers as array(name => value)

Implements Zend_Mail_Part_Interface.

Definition at line 307 of file Part.php.

getPart ( num )

Get part of multipart message

Parameters:
int$numnumber of part starting with 1 for first part
Returns:
Zend_Mail_Part wanted part
Exceptions:
Zend_Mail_Exception

See also:
Zend_Mail_Exception
Zend_Mail_Exception

Implements Zend_Mail_Part_Interface.

Reimplemented in Zend_Mail_Part_File.

Definition at line 239 of file Part.php.

getSize (  )

Return size of part

Quite simple implemented currently (not decoding). Handle with care.

Returns:
int size

Implements Zend_Mail_Part_Interface.

Reimplemented in Zend_Mail_Part_File.

Definition at line 191 of file Part.php.

hasChildren (  )

implements RecursiveIterator::hasChildren()

Returns:
bool current element has children/is multipart

Definition at line 451 of file Part.php.

headerExists ( name )

Check wheater the Mail part has a specific header.

Parameters:
string$name
Returns:
boolean

Definition at line 375 of file Part.php.

isMultipart (  )

Check if part is a multipart message

Returns:
bool if part is multipart

Implements Zend_Mail_Part_Interface.

Definition at line 149 of file Part.php.

key (  )

implements Iterator::key()

Returns:
string key/number of current part

Definition at line 495 of file Part.php.

next (  )

implements Iterator::next()

Returns:
null

Definition at line 485 of file Part.php.

rewind (  )

implements Iterator::rewind()

Returns:
null

Definition at line 515 of file Part.php.

valid (  )

implements Iterator::valid()

Returns:
bool check if there's a current element

Definition at line 472 of file Part.php.


The documentation for this class was generated from the following file: