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

Config   A

Complexity

Total Complexity 15

Size/Duplication

Total Lines 72
Duplicated Lines 0 %

Coupling/Cohesion

Components 3
Dependencies 3

Importance

Changes 3
Bugs 0 Features 1
Metric Value
wmc 15
c 3
b 0
f 1
lcom 3
cbo 3
dl 0
loc 72
rs 10

13 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 9 1
A getFormatter() 0 3 1
A getHeaders() 0 3 1
A getBaseDir() 0 3 1
A registerFormatter() 0 3 1
A getFunctionSet() 0 3 1
A getElementData() 0 3 1
A getCssToXpath() 0 3 1
A getValueParser() 0 3 1
A registerProperty() 0 3 1
A registerPseudo() 0 3 1
A loadProperties() 0 3 2
A createPseudoMatcher() 0 5 2
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
}