TYPO3 API  SVNRelease
MimeEntity.php
Go to the documentation of this file.
00001 <?php
00002 
00003 /*
00004  * This file is part of SwiftMailer.
00005  * (c) 2004-2009 Chris Corbyn
00006  *
00007  * For the full copyright and license information, please view the LICENSE
00008  * file that was distributed with this source code.
00009  */
00010 
00011 //@require 'Swift/InputByteStream.php';
00012 //@require 'Swift/Mime/EncodingObserver.php';
00013 //@require 'Swift/Mime/CharsetObserver.php';
00014 
00015 /**
00016  * A MIME entity, such as an attachment.
00017  * @package Swift
00018  * @subpackage Mime
00019  * @author Chris Corbyn
00020  */
00021 interface Swift_Mime_MimeEntity
00022   extends Swift_Mime_CharsetObserver, Swift_Mime_EncodingObserver
00023 {
00024 
00025   /** Main message document; there can only be one of these */
00026   const LEVEL_TOP = 16;
00027 
00028   /** An entity which nests with the same precedence as an attachment */
00029   const LEVEL_MIXED = 256;
00030 
00031   /** An entity which nests with the same precedence as a mime part */
00032   const LEVEL_ALTERNATIVE = 4096;
00033 
00034   /** An entity which nests with the same precedence as embedded content */
00035   const LEVEL_RELATED = 65536;
00036 
00037   /**
00038    * Get the level at which this entity shall be nested in final document.
00039    * The lower the value, the more outermost the entity will be nested.
00040    * @return int
00041    * @see LEVEL_TOP, LEVEL_MIXED, LEVEL_RELATED, LEVEL_ALTERNATIVE
00042    */
00043   public function getNestingLevel();
00044 
00045   /**
00046    * Get the qualified content-type of this mime entity.
00047    * @return string
00048    */
00049   public function getContentType();
00050 
00051   /**
00052    * Returns a unique ID for this entity.
00053    * For most entities this will likely be the Content-ID, though it has
00054    * no explicit semantic meaning and can be considered an identifier for
00055    * programming logic purposes.
00056    * If a Content-ID header is present, this value SHOULD match the value of
00057    * the header.
00058    * @return string
00059    */
00060   public function getId();
00061 
00062   /**
00063    * Get all children nested inside this entity.
00064    * These are not just the immediate children, but all children.
00065    * @return Swift_Mime_MimeEntity[]
00066    */
00067   public function getChildren();
00068 
00069   /**
00070    * Set all children nested inside this entity.
00071    * This includes grandchildren.
00072    * @param Swift_Mime_MimeEntity[] $children
00073    */
00074   public function setChildren(array $children);
00075 
00076   /**
00077    * Get the collection of Headers in this Mime entity.
00078    * @return Swift_Mime_Header[]
00079    */
00080   public function getHeaders();
00081 
00082   /**
00083    * Get the body content of this entity as a string.
00084    * Returns NULL if no body has been set.
00085    * @return string
00086    */
00087   public function getBody();
00088 
00089   /**
00090    * Set the body content of this entity as a string.
00091    * @param string $body
00092    * @param string $contentType optional
00093    */
00094   public function setBody($body, $contentType = null);
00095 
00096   /**
00097    * Get this entire entity in its string form.
00098    * @return string
00099    */
00100   public function toString();
00101 
00102   /**
00103    * Get this entire entity as a ByteStream.
00104    * @param Swift_InputByteStream $is to write to
00105    */
00106   public function toByteStream(Swift_InputByteStream $is);
00107 
00108 }