1 | <?php |
||
8 | class Content implements \Transphporm\Property { |
||
9 | private $headers; |
||
10 | private $formatter; |
||
11 | |||
12 | public function __construct(&$headers, \Transphporm\Hook\Formatter $formatter) { |
||
16 | |||
17 | public function run(array $values, \DomElement $element, array $rules, \Transphporm\Hook\PseudoMatcher $pseudoMatcher, array $properties = []) { |
||
30 | |||
31 | private function shouldRun($element) { |
||
38 | |||
39 | private function getContentMode($rules) { |
||
42 | |||
43 | private function processPseudo($value, $element, $pseudoMatcher) { |
||
53 | |||
54 | private function getNode($node, $document) { |
||
64 | |||
65 | private function convertNode($node, $document) { |
||
66 | if ($node instanceof \DomElement || $node instanceof \DOMComment) { |
||
67 | $new = $document->importNode($node, true); |
||
68 | //Removing this might cause problems with caching... |
||
69 | //$new->setAttribute('transphporm', 'added'); |
||
|
|||
70 | } |
||
71 | else { |
||
72 | if ($node instanceof \DomText) $node = $node->nodeValue; |
||
73 | $new = $document->createElement('text'); |
||
74 | |||
75 | $new->appendChild($document->createTextNode($node)); |
||
76 | $new->setAttribute('transphporm', 'text'); |
||
77 | } |
||
78 | return $new; |
||
79 | } |
||
80 | |||
81 | /** Functions for writing to pseudo elements, attr, before, after, header */ |
||
82 | private function attr($value, $pseudoArgs, $element) { |
||
86 | |||
87 | private function header($value, $pseudoArgs, $element) { |
||
90 | |||
91 | private function before($value, $pseudoArgs, $element) { |
||
97 | |||
98 | private function after($value, $pseudoArgs, $element) { |
||
103 | |||
104 | private function replaceContent($element, $content) { |
||
111 | |||
112 | private function appendContent($element, $content) { |
||
117 | |||
118 | private function removeAllChildren($element) { |
||
121 | } |
||
122 |
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.
The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.
This check looks for comments that seem to be mostly valid code and reports them.