MimeEntity.php 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  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 MIME entity, such as an attachment.
  11. *
  12. * @author Chris Corbyn
  13. */
  14. interface Swift_Mime_MimeEntity extends Swift_Mime_CharsetObserver, Swift_Mime_EncodingObserver
  15. {
  16. /** Main message document; there can only be one of these */
  17. const LEVEL_TOP = 16;
  18. /** An entity which nests with the same precedence as an attachment */
  19. const LEVEL_MIXED = 256;
  20. /** An entity which nests with the same precedence as a mime part */
  21. const LEVEL_ALTERNATIVE = 4096;
  22. /** An entity which nests with the same precedence as embedded content */
  23. const LEVEL_RELATED = 65536;
  24. /**
  25. * Get the level at which this entity shall be nested in final document.
  26. *
  27. * The lower the value, the more outermost the entity will be nested.
  28. * @see LEVEL_TOP, LEVEL_MIXED, LEVEL_RELATED, LEVEL_ALTERNATIVE
  29. *
  30. * @return int
  31. */
  32. public function getNestingLevel();
  33. /**
  34. * Get the qualified content-type of this mime entity.
  35. * @return string
  36. */
  37. public function getContentType();
  38. /**
  39. * Returns a unique ID for this entity.
  40. *
  41. * For most entities this will likely be the Content-ID, though it has
  42. * no explicit semantic meaning and can be considered an identifier for
  43. * programming logic purposes.
  44. *
  45. * If a Content-ID header is present, this value SHOULD match the value of
  46. * the header.
  47. *
  48. * @return string
  49. */
  50. public function getId();
  51. /**
  52. * Get all children nested inside this entity.
  53. *
  54. * These are not just the immediate children, but all children.
  55. *
  56. * @return Swift_Mime_MimeEntity[]
  57. */
  58. public function getChildren();
  59. /**
  60. * Set all children nested inside this entity.
  61. *
  62. * This includes grandchildren.
  63. *
  64. * @param Swift_Mime_MimeEntity[] $children
  65. */
  66. public function setChildren(array $children);
  67. /**
  68. * Get the collection of Headers in this Mime entity.
  69. *
  70. * @return Swift_Mime_HeaderSet
  71. */
  72. public function getHeaders();
  73. /**
  74. * Get the body content of this entity as a string.
  75. *
  76. * Returns NULL if no body has been set.
  77. *
  78. * @return string|null
  79. */
  80. public function getBody();
  81. /**
  82. * Set the body content of this entity as a string.
  83. *
  84. * @param string $body
  85. * @param string $contentType optional
  86. */
  87. public function setBody($body, $contentType = null);
  88. /**
  89. * Get this entire entity in its string form.
  90. *
  91. * @return string
  92. */
  93. public function toString();
  94. /**
  95. * Get this entire entity as a ByteStream.
  96. *
  97. * @param Swift_InputByteStream $is to write to
  98. */
  99. public function toByteStream(Swift_InputByteStream $is);
  100. }