HeaderSet.php 3.8KB

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