Completed
Push — master ( 8cebaa...0cc554 )
by Josh
03:33
created

Configurator::setUp()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 7
ccs 0
cts 6
cp 0
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 5
nc 1
nop 0
crap 2
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\Plugins\HTMLEntities;
9
10
use s9e\TextFormatter\Plugins\ConfiguratorBase;
11
12
class Configurator extends ConfiguratorBase
13
{
14
	/**
15
	* @var string Name of the attribute used by this plugin
16
	*/
17
	protected $attrName = 'char';
18
19
	/**
20
	* {@inheritdoc}
21
	*/
22
	protected $quickMatch = '&';
23
24
	/**
25
	* @var string Regexp that matches entities
26
	*/
27
	protected $regexp = '/&(?>[a-z]+|#(?>[0-9]+|x[0-9a-f]+));/i';
28
29
	/**
30
	* @var string Name of the tag used by this plugin
31
	*/
32
	protected $tagName = 'HE';
33
34
	/**
35
	* {@inheritdoc}
36
	*/
37
	protected function setUp()
38
	{
39
		$tag = $this->configurator->tags->add($this->tagName);
40
		$tag->attributes->add($this->attrName);
41
		$tag->template
42
			= '<xsl:value-of select="@' . htmlspecialchars($this->attrName) . '"/>';
43
	}
44
}