Completed
Branch TemplateInspector (5726eb)
by Josh
09:25
created

ManageParagraphs::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 4
rs 10
c 0
b 0
f 0
ccs 3
cts 3
cp 1
crap 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\RulesGenerators;
9
10
use s9e\TextFormatter\Configurator\Helpers\TemplateInspector;
11
use s9e\TextFormatter\Configurator\RulesGenerators\Interfaces\BooleanRulesGenerator;
12
13
class ManageParagraphs implements BooleanRulesGenerator
14
{
15
	/**
16
	* @var TemplateInspector
17
	*/
18
	protected $p;
19
20
	/**
21
	* Constructor
22
	*
23
	* Prepares the TemplateInspector for <p/>
24
	*/
25 4
	public function __construct()
26
	{
27 4
		$this->p = new TemplateInspector('<p><xsl:apply-templates/></p>');
28 4
	}
29
30
	/**
31
	* {@inheritdoc}
32
	*/
33 4
	public function generateBooleanRules(TemplateInspector $src)
34
	{
35 4
		$rules = [];
36
37 4
		if ($src->allowsChild($this->p) && $src->isBlock() && !$this->p->closesParent($src))
0 ignored issues
show
Bug introduced by
The method isBlock() does not exist on s9e\TextFormatter\Config...lpers\TemplateInspector. Did you maybe mean elementIsBlock()?

This check marks calls to methods that do not seem to exist on an object.

This is most likely the result of a method being renamed without all references to it being renamed likewise.

Loading history...
38
		{
39
			$rules['createParagraphs'] = true;
40
		}
41
42 3
		if ($src->closesParent($this->p))
43
		{
44 2
			$rules['breakParagraph'] = true;
45
		}
46
47 3
		return $rules;
48
	}
49
}