OpenDKIMHeader.php 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  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. * An OpenDKIM Specific Header using only raw header datas without encoding.
  11. *
  12. * @author De Cock Xavier <xdecock@gmail.com>
  13. *
  14. * @deprecated since SwiftMailer 6.1.0; use Swift_Signers_DKIMSigner instead.
  15. */
  16. class Swift_Mime_Headers_OpenDKIMHeader implements Swift_Mime_Header
  17. {
  18. /**
  19. * The value of this Header.
  20. *
  21. * @var string
  22. */
  23. private $value;
  24. /**
  25. * The name of this Header.
  26. *
  27. * @var string
  28. */
  29. private $fieldName;
  30. /**
  31. * @param string $name
  32. */
  33. public function __construct($name)
  34. {
  35. $this->fieldName = $name;
  36. }
  37. /**
  38. * Get the type of Header that this instance represents.
  39. *
  40. * @see TYPE_TEXT, TYPE_PARAMETERIZED, TYPE_MAILBOX
  41. * @see TYPE_DATE, TYPE_ID, TYPE_PATH
  42. *
  43. * @return int
  44. */
  45. public function getFieldType()
  46. {
  47. return self::TYPE_TEXT;
  48. }
  49. /**
  50. * Set the model for the field body.
  51. *
  52. * This method takes a string for the field value.
  53. *
  54. * @param string $model
  55. */
  56. public function setFieldBodyModel($model)
  57. {
  58. $this->setValue($model);
  59. }
  60. /**
  61. * Get the model for the field body.
  62. *
  63. * This method returns a string.
  64. *
  65. * @return string
  66. */
  67. public function getFieldBodyModel()
  68. {
  69. return $this->getValue();
  70. }
  71. /**
  72. * Get the (unencoded) value of this header.
  73. *
  74. * @return string
  75. */
  76. public function getValue()
  77. {
  78. return $this->value;
  79. }
  80. /**
  81. * Set the (unencoded) value of this header.
  82. *
  83. * @param string $value
  84. */
  85. public function setValue($value)
  86. {
  87. $this->value = $value;
  88. }
  89. /**
  90. * Get the value of this header prepared for rendering.
  91. *
  92. * @return string
  93. */
  94. public function getFieldBody()
  95. {
  96. return $this->value;
  97. }
  98. /**
  99. * Get this Header rendered as a RFC 2822 compliant string.
  100. *
  101. * @return string
  102. */
  103. public function toString()
  104. {
  105. return $this->fieldName.': '.$this->value."\r\n";
  106. }
  107. /**
  108. * Set the Header FieldName.
  109. *
  110. * @see Swift_Mime_Header::getFieldName()
  111. */
  112. public function getFieldName()
  113. {
  114. return $this->fieldName;
  115. }
  116. /**
  117. * Ignored.
  118. */
  119. public function setCharset($charset)
  120. {
  121. }
  122. }