@@ -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,11 @@ discard block |
||
| 54 | 65 | return $rules; |
| 55 | 66 | } |
| 56 | 67 | |
| 68 | + /** |
|
| 69 | + * @param integer $pos |
|
| 70 | + * @param integer $next |
|
| 71 | + * @param integer $indexStart |
|
| 72 | + */ |
|
| 57 | 73 | private function processingInstructions($tss, $pos, $next, $indexStart) { |
| 58 | 74 | $rules = []; |
| 59 | 75 | while (($atPos = strpos($tss, '@', $pos)) !== false) { |
@@ -94,6 +110,9 @@ discard block |
||
| 94 | 110 | return $str; |
| 95 | 111 | } |
| 96 | 112 | |
| 113 | + /** |
|
| 114 | + * @param string $str |
|
| 115 | + */ |
|
| 97 | 116 | private function getProperties($str) { |
| 98 | 117 | $stringExtractor = new StringExtractor($str); |
| 99 | 118 | $rules = explode(';', $stringExtractor); |