@@ -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 | } |
@@ -12,6 +12,9 @@ discard block |
||
12 | 12 | private $valueParser; |
13 | 13 | private $xPath; |
14 | 14 | |
15 | + /** |
|
16 | + * @param string $tss |
|
17 | + */ |
|
15 | 18 | public function __construct($tss, $baseDir, CssToXpath $xPath, Value $valueParser) { |
16 | 19 | $this->tss = $this->stripComments($tss, '//', "\n"); |
17 | 20 | $this->tss = $this->stripComments($this->tss, '/*', '*/'); |
@@ -46,6 +49,9 @@ discard block |
||
46 | 49 | return $rules; |
47 | 50 | } |
48 | 51 | |
52 | + /** |
|
53 | + * @param integer $index |
|
54 | + */ |
|
49 | 55 | private function CssToRules($selector, $index, $properties) { |
50 | 56 | //$parts = explode(',', $selector); |
51 | 57 | $parts = $this->splitOnToken($selector, Tokenizer::ARG); |
@@ -70,6 +76,10 @@ discard block |
||
70 | 76 | return $rules; |
71 | 77 | } |
72 | 78 | |
79 | + /** |
|
80 | + * @param integer $key |
|
81 | + * @param integer $indexStart |
|
82 | + */ |
|
73 | 83 | private function processingInstructions($key, $indexStart) { |
74 | 84 | if (isset($this->tss[$key]) && $this->tss[$key]['type'] !== Tokenizer::AT_SIGN) return false; |
75 | 85 | $rules = []; |
@@ -95,6 +105,10 @@ discard block |
||
95 | 105 | return ($a->depth < $b->depth) ? -1 : 1; |
96 | 106 | } |
97 | 107 | |
108 | + /** |
|
109 | + * @param string $open |
|
110 | + * @param string $close |
|
111 | + */ |
|
98 | 112 | private function stripComments($str, $open, $close) { |
99 | 113 | $pos = 0; |
100 | 114 | while (($pos = strpos($str, $open, $pos)) !== false) { |