Completed
Push — master ( c7a737...22a063 )
by Tom
03:13
created

Config::getFormatter()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
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 $elementData;
16
	private $xPath;
17
	private $valueParser;
18
19
	public function __construct(Functionset $functionSet, Parser\Value $valueParser, Hook\ElementData $elementData, Hook\Formatter $formatter, Parser\CssToXpath $xPath, &$headers, &$baseDir) {
20
		$this->formatter = $formatter;
21
		$this->headers = &$headers;
22
		$this->baseDir = &$baseDir;
23
		$this->functionSet = $functionSet;
24
		$this->elementData = $elementData;
25
		$this->xPath = $xPath;
26
		$this->valueParser = $valueParser;
27
	}
28
29
	public function getFormatter() {
30
		return $this->formatter;
31
	}
32
33
	public function &getHeaders() {
34
		return $this->headers;
35
	}
36
37
	public function &getBaseDir() {
38
		return $this->baseDir;
39
	}
40
41
	public function registerFormatter($formatter) {
42
		$this->formatter->register($formatter);
43
	}
44
45
	public function getFunctionSet() {
46
		return $this->functionSet;
47
	}
48
49
	public function getElementData() {
50
		return $this->elementData;
51
	}
52
53
	public function getCssToXpath() {
54
		return $this->xPath;
55
	}
56
57
	public function getValueParser() {
58
		return $this->valueParser;
59
	}
60
61
	public function registerProperty($name, Property $property) {
62
		$this->properties[$name] = $property;
63
	}
64
65
	public function registerPseudo(Pseudo $pseudo) {
66
		$this->pseudo[] = $pseudo;
67
	}
68
69
	public function loadProperties(Hook\PropertyHook $hook) {
70
		foreach ($this->properties as $name => $property) $hook->registerProperty($name, $property);
71
	}
72
73
	public function createPseudoMatcher($pseudo) {
74
		$pseudoMatcher = new Hook\PseudoMatcher($pseudo);
75
		foreach ($this->pseudo as $pseudoFunction) $pseudoMatcher->registerFunction($pseudoFunction);
76
		return $pseudoMatcher;
77
	}
78
79
}