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
|
|
|
public function __construct(Functionset $functionSet, Parser\Value $valueParser, Hook\ElementData $elementData, Hook\Formatter $formatter, Parser\CssToXpath $xPath, FilePath $filePath, &$headers) { |
21
|
|
|
$this->formatter = $formatter; |
22
|
|
|
$this->headers = &$headers; |
23
|
|
|
$this->filePath = $filePath; |
|
|
|
|
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 getFilePath() { |
39
|
|
|
return $this->filePath; |
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
|
|
|
|
This check marks private properties in classes that are never used. Those properties can be removed.