[ Index ]

PHP Cross Reference of phpBB-3.3.14-deutsch

title

Body

[close]

/vendor/s9e/text-formatter/src/Configurator/TemplateNormalizations/ -> DeoptimizeIf.php (source)

   1  <?php
   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\TemplateNormalizations;
   9  
  10  use DOMElement;
  11  
  12  /**
  13  * De-optimize xsl:if elements so that xsl:choose dead branch elimination can apply to them
  14  */
  15  class DeoptimizeIf extends AbstractNormalization
  16  {
  17      /**
  18      * {@inheritdoc}
  19      */
  20      protected $queries = ['//xsl:if[@test]'];
  21  
  22      /**
  23      * {@inheritdoc}
  24      */
  25  	protected function normalizeElement(DOMElement $if)
  26      {
  27          $choose = $this->createElement('xsl:choose');
  28          $when   = $choose->appendChild($this->createElement('xsl:when'));
  29          $when->setAttribute('test', $if->getAttribute('test'));
  30          while ($if->firstChild)
  31          {
  32              $when->appendChild($if->firstChild);
  33          }
  34          $if->parentNode->replaceChild($choose, $if);
  35      }
  36  }


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