|
1 <?php |
|
2 |
|
3 /* |
|
4 * This file is part of SwiftMailer. |
|
5 * (c) 2004-2009 Chris Corbyn |
|
6 * |
|
7 * For the full copyright and license information, please view the LICENSE |
|
8 * file that was distributed with this source code. |
|
9 */ |
|
10 |
|
11 |
|
12 /** |
|
13 * A MIME entity, such as an attachment. |
|
14 * @package Swift |
|
15 * @subpackage Mime |
|
16 * @author Chris Corbyn |
|
17 */ |
|
18 interface Swift_Mime_MimeEntity |
|
19 extends Swift_Mime_CharsetObserver, Swift_Mime_EncodingObserver |
|
20 { |
|
21 |
|
22 /** Main message document; there can only be one of these */ |
|
23 const LEVEL_TOP = 16; |
|
24 |
|
25 /** An entity which nests with the same precedence as an attachment */ |
|
26 const LEVEL_MIXED = 256; |
|
27 |
|
28 /** An entity which nests with the same precedence as a mime part */ |
|
29 const LEVEL_ALTERNATIVE = 4096; |
|
30 |
|
31 /** An entity which nests with the same precedence as embedded content */ |
|
32 const LEVEL_RELATED = 65536; |
|
33 |
|
34 /** |
|
35 * Get the level at which this entity shall be nested in final document. |
|
36 * The lower the value, the more outermost the entity will be nested. |
|
37 * @return int |
|
38 * @see LEVEL_TOP, LEVEL_MIXED, LEVEL_RELATED, LEVEL_ALTERNATIVE |
|
39 */ |
|
40 public function getNestingLevel(); |
|
41 |
|
42 /** |
|
43 * Get the qualified content-type of this mime entity. |
|
44 * @return string |
|
45 */ |
|
46 public function getContentType(); |
|
47 |
|
48 /** |
|
49 * Returns a unique ID for this entity. |
|
50 * For most entities this will likely be the Content-ID, though it has |
|
51 * no explicit semantic meaning and can be considered an identifier for |
|
52 * programming logic purposes. |
|
53 * If a Content-ID header is present, this value SHOULD match the value of |
|
54 * the header. |
|
55 * @return string |
|
56 */ |
|
57 public function getId(); |
|
58 |
|
59 /** |
|
60 * Get all children nested inside this entity. |
|
61 * These are not just the immediate children, but all children. |
|
62 * @return Swift_Mime_MimeEntity[] |
|
63 */ |
|
64 public function getChildren(); |
|
65 |
|
66 /** |
|
67 * Set all children nested inside this entity. |
|
68 * This includes grandchildren. |
|
69 * @param Swift_Mime_MimeEntity[] $children |
|
70 */ |
|
71 public function setChildren(array $children); |
|
72 |
|
73 /** |
|
74 * Get the collection of Headers in this Mime entity. |
|
75 * @return Swift_Mime_Header[] |
|
76 */ |
|
77 public function getHeaders(); |
|
78 |
|
79 /** |
|
80 * Get the body content of this entity as a string. |
|
81 * Returns NULL if no body has been set. |
|
82 * @return string |
|
83 */ |
|
84 public function getBody(); |
|
85 |
|
86 /** |
|
87 * Set the body content of this entity as a string. |
|
88 * @param string $body |
|
89 * @param string $contentType optional |
|
90 */ |
|
91 public function setBody($body, $contentType = null); |
|
92 |
|
93 /** |
|
94 * Get this entire entity in its string form. |
|
95 * @return string |
|
96 */ |
|
97 public function toString(); |
|
98 |
|
99 /** |
|
100 * Get this entire entity as a ByteStream. |
|
101 * @param Swift_InputByteStream $is to write to |
|
102 */ |
|
103 public function toByteStream(Swift_InputByteStream $is); |
|
104 |
|
105 } |