@@ -14,6 +14,10 @@ |
||
| 14 | 14 | const D = self::H*24; |
| 15 | 15 | |
| 16 | 16 | |
| 17 | + /** |
|
| 18 | + * @param string $query |
|
| 19 | + * @param integer $depth |
|
| 20 | + */ |
|
| 17 | 21 | public function __construct($query, $pseudo, $depth, $index, array $properties = []) { |
| 18 | 22 | $this->query = $query; |
| 19 | 23 | $this->pseudo = $pseudo; |
@@ -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 | } |
@@ -7,6 +7,9 @@ |
||
| 7 | 7 | $this->templateFunction = $templateFunction; |
| 8 | 8 | } |
| 9 | 9 | |
| 10 | + /** |
|
| 11 | + * @param string $val |
|
| 12 | + */ |
|
| 10 | 13 | public function html($val) { |
| 11 | 14 | return $this->templateFunction->run([$val]); |
| 12 | 15 | } |
@@ -62,6 +62,10 @@ discard block |
||
| 62 | 62 | return (object) $result; |
| 63 | 63 | } |
| 64 | 64 | |
| 65 | + /** |
|
| 66 | + * @param Template $template |
|
| 67 | + * @param Config $config |
|
| 68 | + */ |
|
| 65 | 69 | private function processRules($template, $config) { |
| 66 | 70 | $rules = $this->getRules($template, $config); |
| 67 | 71 | |
@@ -71,6 +75,10 @@ discard block |
||
| 71 | 75 | } |
| 72 | 76 | |
| 73 | 77 | //Add a postprocessing hook. This cleans up anything transphporm has added to the markup which needs to be removed |
| 78 | + |
|
| 79 | + /** |
|
| 80 | + * @param Template $template |
|
| 81 | + */ |
|
| 74 | 82 | private function doPostProcessing($template) { |
| 75 | 83 | $template->addHook('//*[@transphporm]', new Hook\PostProcess()); |
| 76 | 84 | return $template; |
@@ -63,6 +63,9 @@ discard block |
||
| 63 | 63 | return $rules; |
| 64 | 64 | } |
| 65 | 65 | |
| 66 | + /** |
|
| 67 | + * @param integer $indexStart |
|
| 68 | + */ |
|
| 66 | 69 | private function parseTokens($indexStart) { |
| 67 | 70 | $rules = []; |
| 68 | 71 | $line = 1; |
@@ -90,6 +93,10 @@ discard block |
||
| 90 | 93 | if (empty($rules) && count($this->tss) > 0) throw new \Exception('No TSS rules parsed'); |
| 91 | 94 | } |
| 92 | 95 | |
| 96 | + /** |
|
| 97 | + * @param integer $index |
|
| 98 | + * @param integer $line |
|
| 99 | + */ |
|
| 93 | 100 | private function CssToRules($selector, $index, $properties, $line) { |
| 94 | 101 | $parts = $selector->trim()->splitOnToken(Tokenizer::ARG); |
| 95 | 102 | $rules = []; |
@@ -113,6 +120,9 @@ discard block |
||
| 113 | 120 | return $rules; |
| 114 | 121 | } |
| 115 | 122 | |
| 123 | + /** |
|
| 124 | + * @param integer $indexStart |
|
| 125 | + */ |
|
| 116 | 126 | private function processingInstructions($token, $indexStart) { |
| 117 | 127 | if ($token['type'] !== Tokenizer::AT_SIGN) return false; |
| 118 | 128 | $tokens = $this->tss->from(Tokenizer::AT_SIGN, false)->to(Tokenizer::SEMI_COLON, false); |
@@ -138,6 +148,10 @@ discard block |
||
| 138 | 148 | return ($a->depth < $b->depth) ? -1 : 1; |
| 139 | 149 | } |
| 140 | 150 | |
| 151 | + /** |
|
| 152 | + * @param string $open |
|
| 153 | + * @param string $close |
|
| 154 | + */ |
|
| 141 | 155 | private function stripComments($str, $open, $close) { |
| 142 | 156 | $pos = 0; |
| 143 | 157 | while (($pos = strpos($str, $open, $pos)) !== false) { |