Completed
Push — master ( 39abe4...b867be )
by Richard
02:31
created

Config::getHeaders()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 3
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
/* @description     Transformation Style Sheets - Revolutionising PHP templating    *
3
 * @author          Tom Butler [email protected]                                             *
4
 * @copyright       2015 Tom Butler <[email protected]> | https://r.je/                      *
5
 * @license         http://www.opensource.org/licenses/bsd-license.php  BSD License *
6
 * @version         1.0                                                             */
7
namespace Transphporm;
8
class Config {
9
	private $properties = [];
10
	private $pseudo = [];
11
	private $functionSet;
12
	private $headers;
13
	private $formatter;
14
	private $baseDir;
15
	private $line = 0;
16
	private $elementData;
17
	private $xPath;
18
	private $valueParser;
19
20 View Code Duplication
	public function __construct(Functionset $functionSet, Parser\Value $valueParser, Hook\ElementData $elementData, Hook\Formatter $formatter, Parser\CssToXpath $xPath, &$headers, &$baseDir) {
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
21
		$this->formatter = $formatter;
22
		$this->headers = &$headers;
23
		$this->baseDir = &$baseDir;
24
		$this->functionSet = $functionSet;
25
		$this->elementData = $elementData;
26
		$this->xPath = $xPath;
27
		$this->valueParser = $valueParser;
28
	}
29
30
	public function getFormatter() {
31
		return $this->formatter;
32
	}
33
34
	public function &getHeaders() {
35
		return $this->headers;
36
	}
37
38
	public function &getBaseDir() {
39
		return $this->baseDir;
40
	}
41
42
	public function &getLine() {
43
		return $this->line;
44
	}
45
46
	public function registerFormatter($formatter) {
47
		$this->formatter->register($formatter);
48
	}
49
50
	public function getFunctionSet() {
51
		return $this->functionSet;
52
	}
53
54
	public function getElementData() {
55
		return $this->elementData;
56
	}
57
58
	public function getCssToXpath() {
59
		return $this->xPath;
60
	}
61
62
	public function getValueParser() {
63
		return $this->valueParser;
64
	}
65
66
	public function registerProperty($name, Property $property) {
67
		$this->properties[$name] = $property;
68
	}
69
70
	public function registerPseudo(Pseudo $pseudo) {
71
		$this->pseudo[] = $pseudo;
72
	}
73
74
	public function loadProperties(Hook\PropertyHook $hook) {
75
		foreach ($this->properties as $name => $property) $hook->registerProperty($name, $property);
76
	}
77
78
	public function createPseudoMatcher($pseudo) {
79
		$pseudoMatcher = new Hook\PseudoMatcher($pseudo, $this->valueParser);
80
		foreach ($this->pseudo as $pseudoFunction) $pseudoMatcher->registerFunction(clone $pseudoFunction);
81
		return $pseudoMatcher;
82
	}
83
84
}
85