@@ -19,13 +19,13 @@ discard block |
||
19 | 19 | $this->functionSet = $functionSet; |
20 | 20 | |
21 | 21 | $this->translators = [ |
22 | - Tokenizer::WHITESPACE => function($string) use ($prefix) { return '//' . $prefix . $string; }, |
|
23 | - Tokenizer::MULTIPLY => function () { return '*'; }, |
|
24 | - '' => function($string) use ($prefix) { return '/' . $prefix . $string; }, |
|
25 | - Tokenizer::GREATER_THAN => function($string) use ($prefix) { return '/' . $prefix . $string; }, |
|
26 | - Tokenizer::NUM_SIGN => function($string) { return '[@id=\'' . $string . '\']'; }, |
|
27 | - Tokenizer::DOT => function($string) { return '[contains(concat(\' \', normalize-space(@class), \' \'), \' ' . $string . ' \')]'; }, |
|
28 | - Tokenizer::OPEN_SQUARE_BRACKET => function($string) { return '[' .'php:function(\'\Transphporm\Parser\CssToXpath::processAttr\', \'' . base64_encode(serialize($string)) . '\', ., "' . $this->id . '")' . ']'; } |
|
22 | + Tokenizer::WHITESPACE => function($string) use ($prefix) { return '//'.$prefix.$string; }, |
|
23 | + Tokenizer::MULTIPLY => function() { return '*'; }, |
|
24 | + '' => function($string) use ($prefix) { return '/'.$prefix.$string; }, |
|
25 | + Tokenizer::GREATER_THAN => function($string) use ($prefix) { return '/'.$prefix.$string; }, |
|
26 | + Tokenizer::NUM_SIGN => function($string) { return '[@id=\''.$string.'\']'; }, |
|
27 | + Tokenizer::DOT => function($string) { return '[contains(concat(\' \', normalize-space(@class), \' \'), \' '.$string.' \')]'; }, |
|
28 | + Tokenizer::OPEN_SQUARE_BRACKET => function($string) { return '['.'php:function(\'\Transphporm\Parser\CssToXpath::processAttr\', \''.base64_encode(serialize($string)).'\', ., "'.$this->id.'")'.']'; } |
|
29 | 29 | ]; |
30 | 30 | } |
31 | 31 | |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | $functionSet->setElement($element[0]); |
45 | 45 | |
46 | 46 | $attributes = array(); |
47 | - foreach($element[0]->attributes as $attribute_name => $attribute_node) { |
|
47 | + foreach ($element[0]->attributes as $attribute_name => $attribute_node) { |
|
48 | 48 | $attributes[$attribute_name] = $attribute_node->nodeValue; |
49 | 49 | } |
50 | 50 | |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | private function removeSpacesFromDirectDecend($css) { |
92 | 92 | $tokens = []; |
93 | 93 | foreach ($css->splitOnToken(Tokenizer::GREATER_THAN) as $token) { |
94 | - foreach ($token->trim() as $t) $tokens[] = $t; |
|
94 | + foreach ($token->trim() as $t) $tokens[] = $t; |
|
95 | 95 | $tokens[] = ['type' => Tokenizer::GREATER_THAN]; |
96 | 96 | } |
97 | 97 | return new Tokens(array_slice($tokens, 0, -1)); |
@@ -52,7 +52,7 @@ |
||
52 | 52 | |
53 | 53 | $cachedOutput = $this->loadTemplate(); |
54 | 54 | //To be a valid XML document it must have a root element, automatically wrap it in <template> to ensure it does |
55 | - $template = new Template($this->isValidDoc($cachedOutput['body']) ? str_ireplace('<!doctype', '<!DOCTYPE', $cachedOutput['body']) : '<template>' . $cachedOutput['body'] . '</template>' ); |
|
55 | + $template = new Template($this->isValidDoc($cachedOutput['body']) ? str_ireplace('<!doctype', '<!DOCTYPE', $cachedOutput['body']) : '<template>'.$cachedOutput['body'].'</template>'); |
|
56 | 56 | $valueParser = new Parser\Value($functionSet); |
57 | 57 | $this->config = new Config($functionSet, $valueParser, $elementData, new Hook\Formatter(), new Parser\CssToXpath($functionSet, $template->getPrefix(), md5($this->tss)), new FilePath($this->rootDir), $headers); |
58 | 58 |