You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

69 lines
1.3 KiB

3 years ago
  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. }