@@ -11,6 +11,9 @@ discard block |
||
11 | 11 | private $baseDir; |
12 | 12 | private $prefix; |
13 | 13 | |
14 | + /** |
|
15 | + * @param string $tss |
|
16 | + */ |
|
14 | 17 | public function __construct($tss, $baseDir, $prefix = '') { |
15 | 18 | $this->tss = $this->stripComments($tss); |
16 | 19 | $this->baseDir = $baseDir; |
@@ -36,12 +39,20 @@ discard block |
||
36 | 39 | return $rules; |
37 | 40 | } |
38 | 41 | |
42 | + /** |
|
43 | + * @param string $selector |
|
44 | + * @param integer $index |
|
45 | + */ |
|
39 | 46 | private function CssToRule($selector, $index) { |
40 | 47 | $xPath = new CssToXpath($selector, $this->prefix); |
41 | 48 | $rule = new Rule($xPath->getXpath(), $xPath->getPseudo(), $xPath->getDepth(), $index++); |
42 | 49 | return $rule; |
43 | 50 | } |
44 | 51 | |
52 | + /** |
|
53 | + * @param string $selector |
|
54 | + * @param Rule $newRule |
|
55 | + */ |
|
45 | 56 | private function writeRule($rules, $selector, $newRule) { |
46 | 57 | if (isset($rules[$selector])) $newRule->properties = array_merge($rules[$selector], $newRule->properties); |
47 | 58 | $rules[$selector] = $newRule; |
@@ -49,6 +60,10 @@ discard block |
||
49 | 60 | return $rules; |
50 | 61 | } |
51 | 62 | |
63 | + /** |
|
64 | + * @param integer $pos |
|
65 | + * @param integer $next |
|
66 | + */ |
|
52 | 67 | private function processingInstructions($tss, $pos, $next) { |
53 | 68 | $rules = []; |
54 | 69 | while (($atPos = strpos($tss, '@', $pos)) !== false) { |
@@ -87,6 +102,9 @@ discard block |
||
87 | 102 | return $str; |
88 | 103 | } |
89 | 104 | |
105 | + /** |
|
106 | + * @param string $str |
|
107 | + */ |
|
90 | 108 | private function getProperties($str) { |
91 | 109 | $stringExtractor = new \Transphporm\StringExtractor($str); |
92 | 110 | $rules = explode(';', $stringExtractor); |
@@ -12,6 +12,9 @@ |
||
12 | 12 | private $locale; |
13 | 13 | private $baseDir; |
14 | 14 | |
15 | + /** |
|
16 | + * @param string $baseDir |
|
17 | + */ |
|
15 | 18 | public function __construct(\SplObjectStorage $objectStorage, $data, $locale, $baseDir) { |
16 | 19 | $this->dataStorage = $objectStorage; |
17 | 20 | $this->data = $data; |
@@ -35,6 +35,9 @@ |
||
35 | 35 | return false; |
36 | 36 | } |
37 | 37 | |
38 | + /** |
|
39 | + * @param \Transphporm\Hook\Rule $rule |
|
40 | + */ |
|
38 | 41 | private function createHook($newRules, $rule) { |
39 | 42 | $hook = new \Transphporm\Hook\Rule($newRules, $rule->getPseudoMatcher(), $this->data); |
40 | 43 | foreach ($rule->getProperties() as $name => $property) $hook->registerProperty($name, $property); |
@@ -63,6 +63,9 @@ discard block |
||
63 | 63 | return $array; |
64 | 64 | } |
65 | 65 | |
66 | + /** |
|
67 | + * @param null|\DOMElement $element |
|
68 | + */ |
|
66 | 69 | private function callFunc($name, $params, $element) { |
67 | 70 | if ($name && is_callable([$this->dataFunction, $name])) { |
68 | 71 | return $this->dataFunction->$name($this->parse($params, $element), $element); |
@@ -70,6 +73,10 @@ discard block |
||
70 | 73 | return false; |
71 | 74 | } |
72 | 75 | |
76 | + /** |
|
77 | + * @param string $remaining |
|
78 | + * @param null|\DOMElement $element |
|
79 | + */ |
|
73 | 80 | private function parseNextValue($remaining, $result, $element) { |
74 | 81 | if (strlen($remaining) > 0 && $remaining[0] == ',') $result = array_merge($result, $this->parse(trim(substr($remaining, 1)), $element)); |
75 | 82 | return $result; |