1 | <?php |
||
8 | class Content implements \Transphporm\Property { |
||
9 | private $data; |
||
10 | private $headers; |
||
11 | private $formatter; |
||
12 | |||
13 | |||
14 | public function __construct($data, &$headers, \Transphporm\Hook\Formatter $formatter) { |
||
19 | |||
20 | public function run($value, \DomElement $element, array $rules, \Transphporm\Hook\PseudoMatcher $pseudoMatcher, array $properties = []) { |
||
21 | if ($element->getAttribute('transphporm') === 'remove') return; |
||
22 | |||
23 | $value = $this->formatter->format($value, $rules); |
||
24 | if (!$this->processPseudo($value, $element, $pseudoMatcher)) { |
||
25 | //Remove the current contents |
||
26 | $this->removeAllChildren($element); |
||
27 | //Now make a text node |
||
28 | if ($this->getContentMode($rules) === 'replace') $this->replaceContent($element, $value); |
||
29 | else $this->appendContent($element, $value); |
||
30 | } |
||
31 | } |
||
32 | |||
33 | private function getContentMode($rules) { |
||
36 | |||
37 | private function processPseudo($value, $element, $pseudoMatcher) { |
||
47 | |||
48 | private function getNode($node, $document) { |
||
63 | |||
64 | /** Functions for writing to pseudo elements, attr, before, after, header */ |
||
65 | private function attr($value, $pseudoArgs, $element) { |
||
68 | |||
69 | private function header($value, $pseudoArgs, $element) { |
||
72 | |||
73 | private function before($value, $pseudoArgs, $element) { |
||
79 | |||
80 | private function after($value, $pseudoArgs, $element) { |
||
85 | |||
86 | private function removeAdded($e) { |
||
93 | |||
94 | private function replaceContent($element, $content) { |
||
102 | |||
103 | private function appendContent($element, $content) { |
||
108 | |||
109 | private function removeAllChildren($element) { |
||
112 | } |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.