Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.2.x will end 22 April 2024 (12 months).
  • Bug fixes for security issues in 4.2.x will end 7 October 2024 (18 months).
  • PHP version: minimum PHP 8.0.0 Note: minimum PHP version has increased since Moodle 4.1. PHP 8.1.x is supported too.
   1  <?php
   2  
   3  namespace PhpXmlRpc\Traits;
   4  
   5  trait PayloadBearer
   6  {
   7      /** @var string */
   8      protected $payload;
   9      /** @var string */
  10      protected $content_type = 'text/xml';
  11  
  12      /**
  13       * @internal
  14       *
  15       * @param string $payload
  16       * @param string $contentType
  17       * @return $this
  18       */
  19      public function setPayload($payload, $contentType = '')
  20      {
  21          $this->payload = $payload;
  22  
  23          if ($contentType != '') {
  24              $this->content_type = $contentType;
  25          }
  26  
  27          return $this;
  28      }
  29  
  30      /**
  31       * @return string
  32       */
  33      public function getPayload()
  34      {
  35          return $this->payload;
  36      }
  37  
  38      /**
  39       * @return string
  40       */
  41      public function getContentType()
  42      {
  43          return $this->content_type;
  44      }
  45  }