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