@@ -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(['<template>' . $val . '</template>']); |
| 12 | 15 | } |
@@ -4,6 +4,9 @@ |
||
| 4 | 4 | private $insertLocation; |
| 5 | 5 | private $content; |
| 6 | 6 | |
| 7 | + /** |
|
| 8 | + * @param string $insertLocation |
|
| 9 | + */ |
|
| 7 | 10 | public function __construct($insertLocation, \Transphporm\Property\Content $content) { |
| 8 | 11 | $this->insertLocation = $insertLocation; |
| 9 | 12 | $this->content = $content; |
@@ -30,6 +30,9 @@ discard block |
||
| 30 | 30 | return $rules; |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | + /** |
|
| 34 | + * @param integer $indexStart |
|
| 35 | + */ |
|
| 33 | 36 | private function parseTokens($indexStart) { |
| 34 | 37 | $this->rules = []; |
| 35 | 38 | foreach (new TokenFilterIterator($this->tss, [Tokenizer::WHITESPACE]) as $token) { |
@@ -55,6 +58,10 @@ discard block |
||
| 55 | 58 | if (empty($rules) && count($this->tss) > 0) throw new \Exception('No TSS rules parsed'); |
| 56 | 59 | } |
| 57 | 60 | |
| 61 | + /** |
|
| 62 | + * @param Tokens $selector |
|
| 63 | + * @param integer $index |
|
| 64 | + */ |
|
| 58 | 65 | private function CssToRules($selector, $index, $properties, $line) { |
| 59 | 66 | $parts = $selector->trim()->splitOnToken(Tokenizer::ARG); |
| 60 | 67 | $rules = []; |
@@ -78,6 +85,9 @@ discard block |
||
| 78 | 85 | return $rules; |
| 79 | 86 | } |
| 80 | 87 | |
| 88 | + /** |
|
| 89 | + * @param integer $indexStart |
|
| 90 | + */ |
|
| 81 | 91 | private function processingInstructions($token, $indexStart) { |
| 82 | 92 | if ($token['type'] !== Tokenizer::AT_SIGN) return false; |
| 83 | 93 | $tokens = $this->tss->from(Tokenizer::AT_SIGN, false)->to(Tokenizer::SEMI_COLON, false); |
@@ -42,6 +42,9 @@ discard block |
||
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | |
| 45 | + /** |
|
| 46 | + * @param \Transphporm\Template $template |
|
| 47 | + */ |
|
| 45 | 48 | public function processRules($template, \Transphporm\Config $config) { |
| 46 | 49 | $rules = $this->getRules($config->getCssToXpath(), $config->getValueParser()); |
| 47 | 50 | |
@@ -57,11 +60,20 @@ discard block |
||
| 57 | 60 | } |
| 58 | 61 | |
| 59 | 62 | //Load the TSS |
| 63 | + |
|
| 64 | + /** |
|
| 65 | + * @param \Transphporm\Parser\CssToXpath $cssToXpath |
|
| 66 | + * @param \Transphporm\Parser\Value $valueParser |
|
| 67 | + */ |
|
| 60 | 68 | public function getRules($cssToXpath, $valueParser, $indexStart = 0) { |
| 61 | 69 | return $this->tss->getRules($cssToXpath, $valueParser, $this, $indexStart); |
| 62 | 70 | } |
| 63 | 71 | |
| 64 | 72 | //Process a TSS rule e.g. `ul li {content: "foo"; format: bar} |
| 73 | + |
|
| 74 | + /** |
|
| 75 | + * @param \Transphporm\Config $config |
|
| 76 | + */ |
|
| 65 | 77 | private function executeTssRule($rule, $template, $config) { |
| 66 | 78 | $rule->touch(); |
| 67 | 79 | |
@@ -52,6 +52,9 @@ discard block |
||
| 52 | 52 | return array_keys(array_column($this->tokens, 'type'), $tokenType); |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | + /** |
|
| 56 | + * @return integer|null |
|
| 57 | + */ |
|
| 55 | 58 | private function getKeyToSlice($tokenType) { |
| 56 | 59 | $keys = $this->getKeysOfTokenType($tokenType); |
| 57 | 60 | if (empty($keys)) return false; |
@@ -68,6 +71,9 @@ discard block |
||
| 68 | 71 | return $this->sliceTokens($tokenType, "to", $inclusive); |
| 69 | 72 | } |
| 70 | 73 | |
| 74 | + /** |
|
| 75 | + * @param string $type |
|
| 76 | + */ |
|
| 71 | 77 | private function sliceTokens($tokenType, $type, $increment = false) { |
| 72 | 78 | $key = $this->getKeyToSlice($tokenType); |
| 73 | 79 | if ($key === false) return new Tokens([]); |
@@ -76,6 +82,9 @@ discard block |
||
| 76 | 82 | else return new Tokens(array_slice($this->tokens, $this->iterator, $key)); |
| 77 | 83 | } |
| 78 | 84 | |
| 85 | + /** |
|
| 86 | + * @param integer $count |
|
| 87 | + */ |
|
| 79 | 88 | public function skip($count) { |
| 80 | 89 | $this->iterator += $count; |
| 81 | 90 | } |