[ Index ]

PHP Cross Reference of phpBB-3.3.7-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-2021 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: Thu Mar 24 21:31:15 2022 Cross-referenced by PHPXref 0.7.1