@@ -30,7 +30,7 @@ |
||
30 | 30 | } |
31 | 31 | |
32 | 32 | public function run(\DomElement $element) { |
33 | - if ($this->file !== null) $this->filePath->setBaseDir(dirname(realpath($this->file)) . DIRECTORY_SEPARATOR); |
|
33 | + if ($this->file !== null) $this->filePath->setBaseDir(dirname(realpath($this->file)).DIRECTORY_SEPARATOR); |
|
34 | 34 | $this->functionSet->setElement($element); |
35 | 35 | $this->configLine = $this->line; |
36 | 36 | try { |
@@ -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) use ($hash) { return '[' .'php:function(\'\Transphporm\Parser\CssToXpath::processAttr\', \'' . base64_encode(serialize($string)) . '\', ., "' . $hash . '")' . ']'; } |
|
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) use ($hash) { return '['.'php:function(\'\Transphporm\Parser\CssToXpath::processAttr\', \''.base64_encode(serialize($string)).'\', ., "'.$hash.'")'.']'; } |
|
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)); |