[ Index ]

PHP Cross Reference of phpBB-3.3.12-deutsch

title

Body

[close]

/vendor/s9e/text-formatter/src/Configurator/TemplateNormalizations/ -> MergeConsecutiveCopyOf.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  class MergeConsecutiveCopyOf extends AbstractNormalization
  13  {
  14      /**
  15      * {@inheritdoc}
  16      */
  17      protected $queries = ['//xsl:copy-of'];
  18  
  19      /**
  20      * {@inheritdoc}
  21      */
  22  	protected function normalizeElement(DOMElement $element)
  23      {
  24          while ($this->nextSiblingIsCopyOf($element))
  25          {
  26              $element->setAttribute('select', $element->getAttribute('select') . '|' . $element->nextSibling->getAttribute('select'));
  27              $element->parentNode->removeChild($element->nextSibling);
  28          }
  29      }
  30  
  31      /**
  32      * Test whether the next sibling to given element is an xsl:copy-of element
  33      *
  34      * @param  DOMElement $element Context node
  35      * @return bool
  36      */
  37  	protected function nextSiblingIsCopyOf(DOMElement $element)
  38      {
  39          return ($element->nextSibling && $this->isXsl($element->nextSibling, 'copy-of'));
  40      }
  41  }


Generated: Sun Jun 23 12:25:44 2024 Cross-referenced by PHPXref 0.7.1