Completed
Push — master ( 247d83...132dc2 )
by Tom
02:31
created

Config::getElementData()   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
	
16
	public function __construct(Functionset $functionSet, Hook\ElementData $elementData, Hook\Formatter $formatter, &$headers, &$baseDir) {
17
		$this->formatter = $formatter;
18
		$this->headers = &$headers;
19
		$this->baseDir = &$baseDir;
20
		$this->functionSet = $functionSet;
21
		$this->elementData = $elementData;
0 ignored issues
show
Bug introduced by
The property elementData does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
22
	}
23
24
	public function getFormatter() {
25
		return $this->formatter;
26
	}
27
28
	public function &getHeaders() {
29
		return $this->headers;
30
	}
31
32
	public function &getBaseDir() {
33
		return $this->baseDir;
34
	}
35
36
	public function registerFormatter($formatter) {
37
		$this->formatter->register($formatter);
38
	}
39
40
	public function getFunctionSet() {
41
		return $this->functionSet;
42
	}
43
44
	public function getElementData() {
45
		return $this->elementData;
46
	}
47
48
	public function registerProperty($name, Property $property) {
49
		$this->properties[$name] = $property;
50
	}
51
52
	public function registerPseudo(Pseudo $pseudo) {
53
		$this->pseudo[] = $pseudo;
54
	}
55
56
	public function loadProperties(Hook\PropertyHook $hook) {
57
		foreach ($this->properties as $name => $property) $hook->registerProperty($name, $property);
58
	}
59
60
	public function createPseudoMatcher($pseudo) {
61
		$pseudoMatcher = new Hook\PseudoMatcher($pseudo);
62
		foreach ($this->pseudo as $pseudoFunction) $pseudoMatcher->registerFunction($pseudoFunction);
63
		return $pseudoMatcher;
64
	}
65
}