HeaderSet.php 4.1 KB

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