summaryrefslogtreecommitdiff
path: root/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/MimeEntity.php
blob: 30f460cdcdb7f73a73fd9c3927d1253dacc83fc3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
<?php

/*
 * This file is part of SwiftMailer.
 * (c) 2004-2009 Chris Corbyn
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

/**
 * A MIME entity, such as an attachment.
 *
 * @author Chris Corbyn
 */
interface Swift_Mime_MimeEntity extends Swift_Mime_CharsetObserver, Swift_Mime_EncodingObserver
{
    /** Main message document; there can only be one of these */
    const LEVEL_TOP = 16;

    /** An entity which nests with the same precedence as an attachment */
    const LEVEL_MIXED = 256;

    /** An entity which nests with the same precedence as a mime part */
    const LEVEL_ALTERNATIVE = 4096;

    /** An entity which nests with the same precedence as embedded content */
    const LEVEL_RELATED = 65536;

    /**
     * Get the level at which this entity shall be nested in final document.
     *
     * The lower the value, the more outermost the entity will be nested.
     *
     * @see LEVEL_TOP, LEVEL_MIXED, LEVEL_RELATED, LEVEL_ALTERNATIVE
     *
     * @return int
     */
    public function getNestingLevel();

    /**
     * Get the qualified content-type of this mime entity.
     *
     * @return string
     */
    public function getContentType();

    /**
     * Returns a unique ID for this entity.
     *
     * For most entities this will likely be the Content-ID, though it has
     * no explicit semantic meaning and can be considered an identifier for
     * programming logic purposes.
     *
     * If a Content-ID header is present, this value SHOULD match the value of
     * the header.
     *
     * @return string
     */
    public function getId();

    /**
     * Get all children nested inside this entity.
     *
     * These are not just the immediate children, but all children.
     *
     * @return Swift_Mime_MimeEntity[]
     */
    public function getChildren();

    /**
     * Set all children nested inside this entity.
     *
     * This includes grandchildren.
     *
     * @param Swift_Mime_MimeEntity[] $children
     */
    public function setChildren(array $children);

    /**
     * Get the collection of Headers in this Mime entity.
     *
     * @return Swift_Mime_HeaderSet
     */
    public function getHeaders();

    /**
     * Get the body content of this entity as a string.
     *
     * Returns NULL if no body has been set.
     *
     * @return string|null
     */
    public function getBody();

    /**
     * Set the body content of this entity as a string.
     *
     * @param string $body
     * @param string $contentType optional
     */
    public function setBody($body, $contentType = null);

    /**
     * Get this entire entity in its string form.
     *
     * @return string
     */
    public function toString();

    /**
     * Get this entire entity as a ByteStream.
     *
     * @param Swift_InputByteStream $is to write to
     */
    public function toByteStream(Swift_InputByteStream $is);
}