UnstructuredHeader.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Symfony\Component\Mime\Header;
  11. /**
  12. * A Simple MIME Header.
  13. *
  14. * @author Chris Corbyn
  15. */
  16. class UnstructuredHeader extends AbstractHeader
  17. {
  18. private $value;
  19. public function __construct(string $name, string $value)
  20. {
  21. parent::__construct($name);
  22. $this->setValue($value);
  23. }
  24. /**
  25. * @param string $body
  26. */
  27. public function setBody($body)
  28. {
  29. $this->setValue($body);
  30. }
  31. /**
  32. * @return string
  33. */
  34. public function getBody()
  35. {
  36. return $this->getValue();
  37. }
  38. /**
  39. * Get the (unencoded) value of this header.
  40. */
  41. public function getValue(): string
  42. {
  43. return $this->value;
  44. }
  45. /**
  46. * Set the (unencoded) value of this header.
  47. */
  48. public function setValue(string $value)
  49. {
  50. $this->value = $value;
  51. }
  52. /**
  53. * Get the value of this header prepared for rendering.
  54. */
  55. public function getBodyAsString(): string
  56. {
  57. return $this->encodeWords($this, $this->value);
  58. }
  59. }