@@ -18,6 +18,9 @@ |
||
18 | 18 | return ucwords($val); |
19 | 19 | } |
20 | 20 | |
21 | + /** |
|
22 | + * @param string $val |
|
23 | + */ |
|
21 | 24 | public function html($val) { |
22 | 25 | $doc = new \DomDocument(); |
23 | 26 | $doc->loadXML($val); |
@@ -31,6 +31,9 @@ discard block |
||
31 | 31 | } |
32 | 32 | } |
33 | 33 | |
34 | + /** |
|
35 | + * @param \DOMElement $element |
|
36 | + */ |
|
34 | 37 | private function getArgs($value, $element) { |
35 | 38 | return $this->valueParser->parse($value, $element); |
36 | 39 | } |
@@ -39,6 +42,9 @@ discard block |
||
39 | 42 | $this->properties[$name] = $property; |
40 | 43 | } |
41 | 44 | |
45 | + /** |
|
46 | + * @param \DOMElement $element |
|
47 | + */ |
|
42 | 48 | private function callProperty($name, $element, $value) { |
43 | 49 | if (isset($this->properties[$name])) return $this->properties[$name]->run($value, $element, $this->rules, $this->pseudoMatcher, $this->properties); |
44 | 50 | return false; |
@@ -28,6 +28,9 @@ discard block |
||
28 | 28 | } |
29 | 29 | } |
30 | 30 | |
31 | + /** |
|
32 | + * @param \DOMElement $element |
|
33 | + */ |
|
31 | 34 | private function shouldRun($element) { |
32 | 35 | do { |
33 | 36 | if ($element->getAttribute('transphporm') == 'includedtemplate') return false; |
@@ -40,6 +43,10 @@ discard block |
||
40 | 43 | return (isset($rules['content-mode'])) ? $rules['content-mode'] : 'append'; |
41 | 44 | } |
42 | 45 | |
46 | + /** |
|
47 | + * @param \DOMElement $element |
|
48 | + * @param \Transphporm\Hook\PseudoMatcher $pseudoMatcher |
|
49 | + */ |
|
43 | 50 | private function processPseudo($value, $element, $pseudoMatcher) { |
44 | 51 | $pseudoContent = ['attr', 'header', 'before', 'after']; |
45 | 52 | foreach ($pseudoContent as $pseudo) { |
@@ -96,6 +103,9 @@ discard block |
||
96 | 103 | } |
97 | 104 | } |
98 | 105 | |
106 | + /** |
|
107 | + * @param \DOMElement $element |
|
108 | + */ |
|
99 | 109 | private function replaceContent($element, $content) { |
100 | 110 | //If this rule was cached, the elements that were added last time need to be removed prior to running the rule again. |
101 | 111 | foreach ($this->getNode($content, $element->ownerDocument) as $node) { |
@@ -104,12 +114,18 @@ discard block |
||
104 | 114 | $element->setAttribute('transphporm', 'remove'); |
105 | 115 | } |
106 | 116 | |
117 | + /** |
|
118 | + * @param \DOMElement $element |
|
119 | + */ |
|
107 | 120 | private function appendContent($element, $content) { |
108 | 121 | foreach ($this->getNode($content, $element->ownerDocument) as $node) { |
109 | 122 | $element->appendChild($node); |
110 | 123 | } |
111 | 124 | } |
112 | 125 | |
126 | + /** |
|
127 | + * @param \DOMElement $element |
|
128 | + */ |
|
113 | 129 | private function removeAllChildren($element) { |
114 | 130 | while ($element->hasChildNodes()) $element->removeChild($element->firstChild); |
115 | 131 | } |
@@ -13,6 +13,9 @@ discard block |
||
13 | 13 | private $xPath; |
14 | 14 | private $tokenizer; |
15 | 15 | |
16 | + /** |
|
17 | + * @param string $tss |
|
18 | + */ |
|
16 | 19 | public function __construct($tss, $baseDir, CssToXpath $xPath, Value $valueParser) { |
17 | 20 | $this->tss = $this->stripComments($tss, '//', "\n"); |
18 | 21 | $this->tss = $this->stripComments($this->tss, '/*', '*/'); |
@@ -44,6 +47,9 @@ discard block |
||
44 | 47 | return $rules; |
45 | 48 | } |
46 | 49 | |
50 | + /** |
|
51 | + * @param integer $index |
|
52 | + */ |
|
47 | 53 | private function CssToRules($selector, $index, $properties) { |
48 | 54 | $parts = $selector->trim()->splitOnToken(Tokenizer::ARG); |
49 | 55 | $rules = []; |
@@ -67,6 +73,9 @@ discard block |
||
67 | 73 | return $rules; |
68 | 74 | } |
69 | 75 | |
76 | + /** |
|
77 | + * @param integer $indexStart |
|
78 | + */ |
|
70 | 79 | private function processingInstructions($token, $indexStart) { |
71 | 80 | if ($token['type'] !== Tokenizer::AT_SIGN) return false; |
72 | 81 | $tokens = $this->tss->from(Tokenizer::AT_SIGN, false)->to(Tokenizer::SEMI_COLON, false); |
@@ -90,6 +99,10 @@ discard block |
||
90 | 99 | return ($a->depth < $b->depth) ? -1 : 1; |
91 | 100 | } |
92 | 101 | |
102 | + /** |
|
103 | + * @param string $open |
|
104 | + * @param string $close |
|
105 | + */ |
|
93 | 106 | private function stripComments($str, $open, $close) { |
94 | 107 | $pos = 0; |
95 | 108 | while (($pos = strpos($str, $open, $pos)) !== false) { |