4 * This file is part of SwiftMailer.
5 * (c) 2004-2009 Chris Corbyn
7 * For the full copyright and license information, please view the LICENSE
8 * file that was distributed with this source code.
11 //@require 'Swift/InputByteStream.php';
12 //@require 'Swift/Mime/EncodingObserver.php';
13 //@require 'Swift/Mime/CharsetObserver.php';
16 * A MIME entity, such as an attachment.
19 * @author Chris Corbyn
21 interface Swift_Mime_MimeEntity
22 extends Swift_Mime_CharsetObserver
, Swift_Mime_EncodingObserver
25 /** Main message document; there can only be one of these */
28 /** An entity which nests with the same precedence as an attachment */
29 const LEVEL_MIXED
= 256;
31 /** An entity which nests with the same precedence as a mime part */
32 const LEVEL_ALTERNATIVE
= 4096;
34 /** An entity which nests with the same precedence as embedded content */
35 const LEVEL_RELATED
= 65536;
38 * Get the level at which this entity shall be nested in final document.
39 * The lower the value, the more outermost the entity will be nested.
41 * @see LEVEL_TOP, LEVEL_MIXED, LEVEL_RELATED, LEVEL_ALTERNATIVE
43 public function getNestingLevel();
46 * Get the qualified content-type of this mime entity.
49 public function getContentType();
52 * Returns a unique ID for this entity.
53 * For most entities this will likely be the Content-ID, though it has
54 * no explicit semantic meaning and can be considered an identifier for
55 * programming logic purposes.
56 * If a Content-ID header is present, this value SHOULD match the value of
60 public function getId();
63 * Get all children nested inside this entity.
64 * These are not just the immediate children, but all children.
65 * @return Swift_Mime_MimeEntity[]
67 public function getChildren();
70 * Set all children nested inside this entity.
71 * This includes grandchildren.
72 * @param Swift_Mime_MimeEntity[] $children
74 public function setChildren(array $children);
77 * Get the collection of Headers in this Mime entity.
78 * @return Swift_Mime_Header[]
80 public function getHeaders();
83 * Get the body content of this entity as a string.
84 * Returns NULL if no body has been set.
87 public function getBody();
90 * Set the body content of this entity as a string.
92 * @param string $contentType optional
94 public function setBody($body, $contentType = null);
97 * Get this entire entity in its string form.
100 public function toString();
103 * Get this entire entity as a ByteStream.
104 * @param Swift_InputByteStream $is to write to
106 public function toByteStream(Swift_InputByteStream
$is);