Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.3.x will end 7 October 2024 (12 months).
  • Bug fixes for security issues in 4.3.x will end 21 April 2025 (18 months).
  • PHP version: minimum PHP 8.0.0 Note: minimum PHP version has increased since Moodle 4.1. PHP 8.2.x is supported too.
   1  <?php
   2  
   3  namespace PhpXmlRpc\Traits;
   4  
   5  use PhpXmlRpc\Helper\XMLParser;
   6  
   7  trait ParserAware
   8  {
   9      protected static $parser;
  10  
  11      /// @todo feature-creep: allow passing in $options (but then, how to deal with changing options between invocations?)
  12      public function getParser()
  13      {
  14          if (self::$parser === null) {
  15              self::$parser = new XMLParser();
  16          }
  17          return self::$parser;
  18      }
  19  
  20      /**
  21       * @param $parser
  22       * @return void
  23       */
  24      public static function setParser($parser)
  25      {
  26          self::$parser = $parser;
  27      }
  28  }