Interface.php 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. <?php
  2. /**
  3. * Zend Framework
  4. *
  5. * LICENSE
  6. *
  7. * This source file is subject to the new BSD license that is bundled
  8. * with this package in the file LICENSE.txt.
  9. * It is also available through the world-wide-web at this URL:
  10. * http://framework.zend.com/license/new-bsd
  11. * If you did not receive a copy of the license and are unable to
  12. * obtain it through the world-wide-web, please send an email
  13. * to license@zend.com so we can send you a copy immediately.
  14. *
  15. * @category Zend
  16. * @package Zend_Mail
  17. * @subpackage Storage
  18. * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
  19. * @license http://framework.zend.com/license/new-bsd New BSD License
  20. * @version $Id$
  21. */
  22. /**
  23. * @category Zend
  24. * @package Zend_Mail
  25. * @subpackage Storage
  26. * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
  27. * @license http://framework.zend.com/license/new-bsd New BSD License
  28. */
  29. interface Zend_Mail_Part_Interface extends RecursiveIterator
  30. {
  31. /**
  32. * Check if part is a multipart message
  33. *
  34. * @return bool if part is multipart
  35. */
  36. public function isMultipart();
  37. /**
  38. * Body of part
  39. *
  40. * If part is multipart the raw content of this part with all sub parts is returned
  41. *
  42. * @return string body
  43. * @throws Zend_Mail_Exception
  44. */
  45. public function getContent();
  46. /**
  47. * Return size of part
  48. *
  49. * @return int size
  50. */
  51. public function getSize();
  52. /**
  53. * Get part of multipart message
  54. *
  55. * @param int $num number of part starting with 1 for first part
  56. * @return Zend_Mail_Part wanted part
  57. * @throws Zend_Mail_Exception
  58. */
  59. public function getPart($num);
  60. /**
  61. * Count parts of a multipart part
  62. *
  63. * @return int number of sub-parts
  64. */
  65. public function countParts();
  66. /**
  67. * Get all headers
  68. *
  69. * The returned headers are as saved internally. All names are lowercased. The value is a string or an array
  70. * if a header with the same name occurs more than once.
  71. *
  72. * @return array headers as array(name => value)
  73. */
  74. public function getHeaders();
  75. /**
  76. * Get a header in specificed format
  77. *
  78. * Internally headers that occur more than once are saved as array, all other as string. If $format
  79. * is set to string implode is used to concat the values (with Zend_Mime::LINEEND as delim).
  80. *
  81. * @param string $name name of header, matches case-insensitive, but camel-case is replaced with dashes
  82. * @param string $format change type of return value to 'string' or 'array'
  83. * @return string|array value of header in wanted or internal format
  84. * @throws Zend_Mail_Exception
  85. */
  86. public function getHeader($name, $format = null);
  87. /**
  88. * Get a specific field from a header like content type or all fields as array
  89. *
  90. * If the header occurs more than once, only the value from the first header
  91. * is returned.
  92. *
  93. * Throws a Zend_Mail_Exception if the requested header does not exist. If
  94. * the specific header field does not exist, returns null.
  95. *
  96. * @param string $name name of header, like in getHeader()
  97. * @param string $wantedPart the wanted part, default is first, if null an array with all parts is returned
  98. * @param string $firstName key name for the first part
  99. * @return string|array wanted part or all parts as array($firstName => firstPart, partname => value)
  100. * @throws Zend_Exception, Zend_Mail_Exception
  101. */
  102. public function getHeaderField($name, $wantedPart = 0, $firstName = 0);
  103. /**
  104. * Getter for mail headers - name is matched in lowercase
  105. *
  106. * This getter is short for Zend_Mail_Part::getHeader($name, 'string')
  107. *
  108. * @see Zend_Mail_Part::getHeader()
  109. *
  110. * @param string $name header name
  111. * @return string value of header
  112. * @throws Zend_Mail_Exception
  113. */
  114. public function __get($name);
  115. /**
  116. * magic method to get content of part
  117. *
  118. * @return string content
  119. */
  120. public function __toString();
  121. }