[ Index ]

PHP Cross Reference of phpBB-3.2.11-deutsch

title

Body

[close]

/vendor/s9e/text-formatter/src/ -> Bundle.php (source)

   1  <?php
   2  
   3  /*
   4  * @package   s9e\TextFormatter
   5  * @copyright Copyright (c) 2010-2019 The s9e Authors
   6  * @license   http://www.opensource.org/licenses/mit-license.php The MIT License
   7  */
   8  namespace s9e\TextFormatter;
   9  abstract class Bundle
  10  {
  11  	public static function getCachedParser()
  12      {
  13          if (!isset(static::$parser))
  14              static::$parser = static::getParser();
  15          return static::$parser;
  16      }
  17  	public static function getCachedRenderer()
  18      {
  19          if (!isset(static::$renderer))
  20              static::$renderer = static::getRenderer();
  21          return static::$renderer;
  22      }
  23  	public static function parse($text)
  24      {
  25          if (isset(static::$beforeParse))
  26              $text = \call_user_func(static::$beforeParse, $text);
  27          $xml = static::getCachedParser()->parse($text);
  28          if (isset(static::$afterParse))
  29              $xml = \call_user_func(static::$afterParse, $xml);
  30          return $xml;
  31      }
  32  	public static function render($xml, array $params = [])
  33      {
  34          $renderer = static::getCachedRenderer();
  35          if (!empty($params))
  36              $renderer->setParameters($params);
  37          if (isset(static::$beforeRender))
  38              $xml = \call_user_func(static::$beforeRender, $xml);
  39          $output = $renderer->render($xml);
  40          if (isset(static::$afterRender))
  41              $output = \call_user_func(static::$afterRender, $output);
  42          return $output;
  43      }
  44  	public static function reset()
  45      {
  46          static::$parser   = \null;
  47          static::$renderer = \null;
  48      }
  49  	public static function unparse($xml)
  50      {
  51          if (isset(static::$beforeUnparse))
  52              $xml = \call_user_func(static::$beforeUnparse, $xml);
  53          $text = Unparser::unparse($xml);
  54          if (isset(static::$afterUnparse))
  55              $text = \call_user_func(static::$afterUnparse, $text);
  56          return $text;
  57      }
  58  }


Generated: Wed Nov 11 20:33:01 2020 Cross-referenced by PHPXref 0.7.1