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 collection of MIME headers.
13: *
14: * @package Swift
15: * @subpackage Mime
16: *
17: * @author Chris Corbyn
18: */
19: interface Swift_Mime_HeaderSet extends Swift_Mime_CharsetObserver
20: {
21: /**
22: * Add a new Mailbox Header with a list of $addresses.
23: *
24: * @param string $name
25: * @param array|string $addresses
26: */
27: public function addMailboxHeader($name, $addresses = null);
28:
29: /**
30: * Add a new Date header using $timestamp (UNIX time).
31: *
32: * @param string $name
33: * @param int $timestamp
34: */
35: public function addDateHeader($name, $timestamp = null);
36:
37: /**
38: * Add a new basic text header with $name and $value.
39: *
40: * @param string $name
41: * @param string $value
42: */
43: public function addTextHeader($name, $value = null);
44:
45: /**
46: * Add a new ParameterizedHeader with $name, $value and $params.
47: *
48: * @param string $name
49: * @param string $value
50: * @param array $params
51: */
52: public function addParameterizedHeader($name, $value = null,
53: $params = array());
54:
55: /**
56: * Add a new ID header for Message-ID or Content-ID.
57: *
58: * @param string $name
59: * @param string|array $ids
60: */
61: public function addIdHeader($name, $ids = null);
62:
63: /**
64: * Add a new Path header with an address (path) in it.
65: *
66: * @param string $name
67: * @param string $path
68: */
69: public function addPathHeader($name, $path = null);
70:
71: /**
72: * Returns true if at least one header with the given $name exists.
73: *
74: * If multiple headers match, the actual one may be specified by $index.
75: *
76: * @param string $name
77: * @param int $index
78: *
79: * @return boolean
80: */
81: public function has($name, $index = 0);
82:
83: /**
84: * Set a header in the HeaderSet.
85: *
86: * The header may be a previously fetched header via {@link get()} or it may
87: * be one that has been created separately.
88: *
89: * If $index is specified, the header will be inserted into the set at this
90: * offset.
91: *
92: * @param Swift_Mime_Header $header
93: * @param int $index
94: */
95: public function set(Swift_Mime_Header $header, $index = 0);
96:
97: /**
98: * Get the header with the given $name.
99: * If multiple headers match, the actual one may be specified by $index.
100: * Returns NULL if none present.
101: *
102: * @param string $name
103: * @param int $index
104: *
105: * @return Swift_Mime_Header
106: */
107: public function get($name, $index = 0);
108:
109: /**
110: * Get all headers with the given $name.
111: *
112: * @param string $name
113: *
114: * @return array
115: */
116: public function getAll($name = null);
117:
118: /**
119: * Remove the header with the given $name if it's set.
120: *
121: * If multiple headers match, the actual one may be specified by $index.
122: *
123: * @param string $name
124: * @param int $index
125: */
126: public function remove($name, $index = 0);
127:
128: /**
129: * Remove all headers with the given $name.
130: *
131: * @param string $name
132: */
133: public function removeAll($name);
134:
135: /**
136: * Create a new instance of this HeaderSet.
137: *
138: * @return Swift_Mime_HeaderSet
139: */
140: public function newInstance();
141:
142: /**
143: * Define a list of Header names as an array in the correct order.
144: *
145: * These Headers will be output in the given order where present.
146: *
147: * @param array $sequence
148: */
149: public function defineOrdering(array $sequence);
150:
151: /**
152: * Set a list of header names which must always be displayed when set.
153: *
154: * Usually headers without a field value won't be output unless set here.
155: *
156: * @param array $names
157: */
158: public function setAlwaysDisplayed(array $names);
159:
160: /**
161: * Returns a string with a representation of all headers.
162: *
163: * @return string
164: */
165: public function toString();
166: }
167: