@@ -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; |
@@ -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); |
@@ -63,6 +63,9 @@ discard block |
||
| 63 | 63 | return $array; |
| 64 | 64 | } |
| 65 | 65 | |
| 66 | + /** |
|
| 67 | + * @param \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 \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; |
@@ -50,6 +50,9 @@ |
||
| 50 | 50 | return $attr; |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | + /** |
|
| 54 | + * @param string $comparator |
|
| 55 | + */ |
|
| 53 | 56 | private static function compare($comparator, $a, $b) { |
| 54 | 57 | if ($comparator == '=') return $a == $b; |
| 55 | 58 | else if ($comparator == '!=') return $a != $b; |