Passed
Push — master ( d34f9d...e217a6 )
by Josh
02:33
created

InlineCDATA::normalizeText()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 2
dl 0
loc 5
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 1
crap 2
1
<?php
2
3
/**
4
* @package   s9e\TextFormatter
5
* @copyright Copyright (c) 2010-2023 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 DOMText;
11
12
class InlineCDATA extends AbstractNormalization
13
{
14
	/**
15
	* {@inheritdoc}
16
	*/
17
	protected $queries = ['//text()'];
18
19
	/**
20
	* {@inheritdoc}
21
	*/
22 2
	protected function normalizeText(DOMText $node): void
23
	{
24 2
		if ($node->nodeType === XML_CDATA_SECTION_NODE)
25
		{
26 2
			$node->parentNode->replaceChild($this->createText($node->textContent), $node);
27
		}
28
	}
29
}