PayloadBearer.php 760 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. namespace PhpXmlRpc\Traits;
  3. trait PayloadBearer
  4. {
  5. /** @var string */
  6. protected $payload;
  7. /** @var string */
  8. protected $content_type = 'text/xml';
  9. /**
  10. * @internal
  11. *
  12. * @param string $payload
  13. * @param string $contentType
  14. * @return $this
  15. */
  16. public function setPayload($payload, $contentType = '')
  17. {
  18. $this->payload = $payload;
  19. if ($contentType != '') {
  20. $this->content_type = $contentType;
  21. }
  22. return $this;
  23. }
  24. /**
  25. * @return string
  26. */
  27. public function getPayload()
  28. {
  29. return $this->payload;
  30. }
  31. /**
  32. * @return string
  33. */
  34. public function getContentType()
  35. {
  36. return $this->content_type;
  37. }
  38. }