HeaderSet.php 4.0KB

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