@@ -12,6 +12,9 @@ discard block |
||
12 | 12 | private $prefix; |
13 | 13 | private $valueParser; |
14 | 14 | |
15 | + /** |
|
16 | + * @param string $tss |
|
17 | + */ |
|
15 | 18 | public function __construct($tss, $baseDir, Value $valueParser, $prefix = '') { |
16 | 19 | $this->tss = $this->stripComments($tss, '/*', '*/'); |
17 | 20 | $this->tss = $this->stripComments($this->tss, '//', "\n"); |
@@ -38,6 +41,10 @@ discard block |
||
38 | 41 | return $rules; |
39 | 42 | } |
40 | 43 | |
44 | + /** |
|
45 | + * @param string $selector |
|
46 | + * @param integer $index |
|
47 | + */ |
|
41 | 48 | private function CssToRules($selector, $index, $properties) { |
42 | 49 | $parts = explode(',', $selector); |
43 | 50 | $rules = []; |
@@ -60,6 +67,11 @@ discard block |
||
60 | 67 | return $rules; |
61 | 68 | } |
62 | 69 | |
70 | + /** |
|
71 | + * @param integer $pos |
|
72 | + * @param integer $next |
|
73 | + * @param integer $indexStart |
|
74 | + */ |
|
63 | 75 | private function processingInstructions($tss, $pos, $next, $indexStart) { |
64 | 76 | $rules = []; |
65 | 77 | while (($atPos = strpos($tss, '@', $pos)) !== false) { |
@@ -90,6 +102,10 @@ discard block |
||
90 | 102 | return ($a->depth < $b->depth) ? -1 : 1; |
91 | 103 | } |
92 | 104 | |
105 | + /** |
|
106 | + * @param string $open |
|
107 | + * @param string $close |
|
108 | + */ |
|
93 | 109 | private function stripComments($str, $open, $close) { |
94 | 110 | $pos = 0; |
95 | 111 | while (($pos = strpos($str, $open, $pos)) !== false) { |
@@ -100,6 +116,9 @@ discard block |
||
100 | 116 | return $str; |
101 | 117 | } |
102 | 118 | |
119 | + /** |
|
120 | + * @param string $str |
|
121 | + */ |
|
103 | 122 | private function getProperties($str) { |
104 | 123 | $stringExtractor = new StringExtractor($str); |
105 | 124 | $rules = explode(';', $stringExtractor); |
@@ -11,6 +11,9 @@ discard block |
||
11 | 11 | private $formatter; |
12 | 12 | |
13 | 13 | |
14 | + /** |
|
15 | + * @param \Transphporm\FunctionSet $data |
|
16 | + */ |
|
14 | 17 | public function __construct($data, &$headers, \Transphporm\Hook\Formatter $formatter) { |
15 | 18 | $this->data = $data; |
16 | 19 | $this->headers = &$headers; |
@@ -30,6 +33,9 @@ discard block |
||
30 | 33 | } |
31 | 34 | } |
32 | 35 | |
36 | + /** |
|
37 | + * @param \DOMElement $element |
|
38 | + */ |
|
33 | 39 | private function shouldRun($element) { |
34 | 40 | if ($element->getAttribute('transphporm') === 'remove') return false; |
35 | 41 | do { |
@@ -43,6 +49,10 @@ discard block |
||
43 | 49 | return (isset($rules['content-mode'])) ? $rules['content-mode'] : 'append'; |
44 | 50 | } |
45 | 51 | |
52 | + /** |
|
53 | + * @param \DOMElement $element |
|
54 | + * @param \Transphporm\Hook\PseudoMatcher $pseudoMatcher |
|
55 | + */ |
|
46 | 56 | private function processPseudo($value, $element, $pseudoMatcher) { |
47 | 57 | $pseudoContent = ['attr', 'header', 'before', 'after']; |
48 | 58 | foreach ($pseudoContent as $pseudo) { |
@@ -93,6 +103,9 @@ discard block |
||
93 | 103 | } |
94 | 104 | } |
95 | 105 | |
106 | + /** |
|
107 | + * @param \DOMElement $element |
|
108 | + */ |
|
96 | 109 | private function replaceContent($element, $content) { |
97 | 110 | //If this rule was cached, the elements that were added last time need to be removed prior to running the rule again. |
98 | 111 | foreach ($this->getNode($content, $element->ownerDocument) as $node) { |
@@ -101,12 +114,18 @@ discard block |
||
101 | 114 | $element->setAttribute('transphporm', 'remove'); |
102 | 115 | } |
103 | 116 | |
117 | + /** |
|
118 | + * @param \DOMElement $element |
|
119 | + */ |
|
104 | 120 | private function appendContent($element, $content) { |
105 | 121 | foreach ($this->getNode($content, $element->ownerDocument) as $node) { |
106 | 122 | $element->appendChild($node); |
107 | 123 | } |
108 | 124 | } |
109 | 125 | |
126 | + /** |
|
127 | + * @param \DOMElement $element |
|
128 | + */ |
|
110 | 129 | private function removeAllChildren($element) { |
111 | 130 | while ($element->hasChildNodes()) $element->removeChild($element->firstChild); |
112 | 131 | } |
@@ -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; |
@@ -25,6 +25,11 @@ |
||
25 | 25 | return true; |
26 | 26 | } |
27 | 27 | |
28 | + /** |
|
29 | + * @param \Transphporm\Parser\Value $valueParser |
|
30 | + * @param \DOMXPath $xpath |
|
31 | + * @param \DOMElement $element |
|
32 | + */ |
|
28 | 33 | private function notElement($css, $valueParser, $xpath, $element) { |
29 | 34 | foreach ($css as $selector) { |
30 | 35 | $xpathString = $this->cssToXpath->getXpath($selector); |
@@ -34,6 +34,9 @@ discard block |
||
34 | 34 | return $this->data->$func(...$args); |
35 | 35 | } |
36 | 36 | |
37 | + /** |
|
38 | + * @param Value $parser |
|
39 | + */ |
|
37 | 40 | public function parseNested($parser, $token, $funcName) { |
38 | 41 | $args = $parser->parseTokens($token['value'], $this->data); |
39 | 42 | if ($args[0] == $this->data) $args = []; |
@@ -49,6 +52,9 @@ discard block |
||
49 | 52 | else return call_user_func_array([$obj, $func], $args); |
50 | 53 | } |
51 | 54 | |
55 | + /** |
|
56 | + * @param boolean $autoLookup |
|
57 | + */ |
|
52 | 58 | public function extract($last, $autoLookup) { |
53 | 59 | if ($autoLookup && isset($this->data->{$last})) { |
54 | 60 | return $this->data->{$last}; |