Completed
Push — master ( cec30b...a73b11 )
by Josh
03:50
created

Optimizer::optimizeTemplate()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 4
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 2
1
<?php
2
3
/**
4
* @package   s9e\TextFormatter
5
* @copyright Copyright (c) 2010-2019 The s9e Authors
6
* @license   http://www.opensource.org/licenses/mit-license.php The MIT License
7
*/
8
namespace s9e\TextFormatter\Configurator\RendererGenerators\XSLT;
9
10
use s9e\TextFormatter\Configurator\TemplateNormalizer;
11
12
class Optimizer
13
{
14
	/**
15
	* @var TemplateNormalizer
16
	*/
17
	public $normalizer;
18
19
	/**
20
	* Constructor
21
	*/
22
	public function __construct()
23
	{
24
		$this->normalizer = new TemplateNormalizer([
25
			'MergeConsecutiveCopyOf',
26
			'MergeIdenticalConditionalBranches',
27
			'OptimizeNestedConditionals',
28
			'RemoveLivePreviewAttributes'
29
		]);
30
	}
31
32
	/**
33
	* Optimize a single template
34
	*
35
	* @param  string $template Original template
36
	* @return string           Optimized template
37
	*/
38
	public function optimizeTemplate($template)
39
	{
40
		return $this->normalizer->normalizeTemplate($template);
41
	}
42
}