1 | <?php |
||
9 | class PropertyHook implements \Transphporm\Hook { |
||
10 | private $rules; |
||
11 | private $origBaseDir; |
||
12 | private $newBaseDir; |
||
13 | private $valueParser; |
||
14 | private $pseudoMatcher; |
||
15 | private $properties = []; |
||
16 | private $functionSet; |
||
17 | |||
18 | public function __construct(array $rules, &$origBaseDir, $newBaseDir, PseudoMatcher $pseudoMatcher, \Transphporm\Parser\Value $valueParser, \Transphporm\FunctionSet $functionSet) { |
||
26 | |||
27 | public function run(\DomElement $element) { |
||
28 | $this->functionSet->setElement($element); |
||
29 | $this->origBaseDir = $this->newBaseDir; |
||
30 | //Don't run if there's a pseudo element like nth-child() and this element doesn't match it |
||
31 | if (!$this->pseudoMatcher->matches($element)) return; |
||
32 | |||
33 | // TODO: Have all rule values parsed before running them so that things like `content-append` are not expecting tokens |
||
34 | // problem with this is that anything in data changed by run properties is not shown |
||
35 | // TODO: Allow `update-frequency` to be parsed before it is accessed in rule (might need to switch location of rule check) |
||
36 | |||
37 | foreach ($this->rules as $name => $value) { |
||
38 | $result = $this->callProperty($name, $element, $this->getArgs($value, $element)); |
||
39 | if ($result === false) break; |
||
40 | } |
||
41 | } |
||
42 | |||
43 | private function getArgs($value, $element) { |
||
46 | |||
47 | public function registerProperty($name, \Transphporm\Property $property) { |
||
50 | |||
51 | private function callProperty($name, $element, $value) { |
||
54 | } |
||
55 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.