@@ -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->baseDir = $baseDir; |
@@ -38,12 +41,20 @@ discard block |
||
| 38 | 41 | return $rules; |
| 39 | 42 | } |
| 40 | 43 | |
| 44 | + /** |
|
| 45 | + * @param string $selector |
|
| 46 | + * @param integer $index |
|
| 47 | + */ |
|
| 41 | 48 | private function CssToRule($selector, $index) { |
| 42 | 49 | $xPath = new CssToXpath($selector, $this->valueParser, $this->prefix); |
| 43 | 50 | $rule = new \Transphporm\Rule($xPath->getXpath(), $xPath->getPseudo(), $xPath->getDepth(), $index++); |
| 44 | 51 | return $rule; |
| 45 | 52 | } |
| 46 | 53 | |
| 54 | + /** |
|
| 55 | + * @param string $selector |
|
| 56 | + * @param \Transphporm\Rule $newRule |
|
| 57 | + */ |
|
| 47 | 58 | private function writeRule($rules, $selector, $newRule) { |
| 48 | 59 | if (isset($rules[$selector])) { |
| 49 | 60 | $newRule->properties = array_merge($rules[$selector]->properties, $newRule->properties); |
@@ -54,6 +65,10 @@ discard block |
||
| 54 | 65 | return $rules; |
| 55 | 66 | } |
| 56 | 67 | |
| 68 | + /** |
|
| 69 | + * @param integer $pos |
|
| 70 | + * @param integer $next |
|
| 71 | + */ |
|
| 57 | 72 | private function processingInstructions($tss, $pos, $next) { |
| 58 | 73 | $rules = []; |
| 59 | 74 | while (($atPos = strpos($tss, '@', $pos)) !== false) { |
@@ -94,6 +109,9 @@ discard block |
||
| 94 | 109 | return $str; |
| 95 | 110 | } |
| 96 | 111 | |
| 112 | + /** |
|
| 113 | + * @param string $str |
|
| 114 | + */ |
|
| 97 | 115 | private function getProperties($str) { |
| 98 | 116 | $stringExtractor = new StringExtractor($str); |
| 99 | 117 | $rules = explode(';', $stringExtractor); |
@@ -35,6 +35,9 @@ |
||
| 35 | 35 | return false; |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | + /** |
|
| 39 | + * @param \Transphporm\Hook\PropertyHook $rule |
|
| 40 | + */ |
|
| 38 | 41 | private function createHook($newRules, $rule) { |
| 39 | 42 | $hook = new \Transphporm\Hook\PropertyHook($newRules, $rule->getPseudoMatcher(), new \Transphporm\Parser\Value($this->data)); |
| 40 | 43 | foreach ($rule->getProperties() as $name => $property) $hook->registerProperty($name, $property); |