Completed
Branch TemplateNormalizations (ae42e4)
by Josh
33:16
created

TransposeComments   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 1
dl 0
loc 16
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A normalizeNode() 0 5 1
1
<?php
2
3
/**
4
* @package   s9e\TextFormatter
5
* @copyright Copyright (c) 2010-2017 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 DOMNode;
11
12
/**
13
* Converts comments into xsl:comment elements
14
*/
15
class TransposeComments extends AbstractNormalization
16
{
17
	/**
18
	* {@inheritdoc}
19
	*/
20
	protected $queries = ['//comment()'];
21
22
	/**
23
	* {@inheritdoc}
24
	*/
25
	protected function normalizeNode(DOMNode $node)
26
	{
27
		$xslComment = $this->createElement('xsl:comment', $node->nodeValue);
28
		$node->parentNode->replaceChild($xslComment, $node);
29
	}
30
}