[ Index ]

PHP Cross Reference of phpBB-3.3.14-deutsch

title

Body

[close]

/vendor/s9e/text-formatter/src/Configurator/RecursiveParser/ -> CachingRecursiveParser.php (source)

   1  <?php declare(strict_types=1);
   2  
   3  /**
   4  * @package   s9e\TextFormatter
   5  * @copyright Copyright (c) 2010-2022 The s9e authors
   6  * @license   http://www.opensource.org/licenses/mit-license.php The MIT License
   7  */
   8  namespace s9e\TextFormatter\Configurator\RecursiveParser;
   9  
  10  use s9e\TextFormatter\Configurator\RecursiveParser;
  11  
  12  class CachingRecursiveParser extends RecursiveParser
  13  {
  14      /**
  15      * @var array
  16      */
  17      protected $cache;
  18  
  19      /**
  20      * {@inheritdoc}
  21      */
  22  	public function parse(string $str, string $restrict = '')
  23      {
  24          if (!isset($this->cache[$restrict][$str]))
  25          {
  26              $this->cache[$restrict][$str] = parent::parse($str, $restrict);
  27          }
  28  
  29          return $this->cache[$restrict][$str];
  30      }
  31  
  32      /**
  33      * {@inheritdoc}
  34      */
  35  	public function setMatchers(array $matchers): void
  36      {
  37          $this->cache = [];
  38          parent::setMatchers($matchers);
  39      }
  40  }


Generated: Mon Nov 25 19:05:08 2024 Cross-referenced by PHPXref 0.7.1