@@ -20,12 +20,12 @@ discard block |
||
20 | 20 | $this->functionSet = $functionSet; |
21 | 21 | |
22 | 22 | $this->translators = [ |
23 | - ' ' => function($string) use ($prefix) { return '//' . $prefix . $string; }, |
|
24 | - '' => function($string) use ($prefix) { return '/' . $prefix . $string; }, |
|
25 | - '>' => function($string) use ($prefix) { return '/' . $prefix . $string; }, |
|
26 | - '#' => function($string) { return '[@id=\'' . $string . '\']'; }, |
|
27 | - '.' => function($string) { return '[contains(concat(\' \', normalize-space(@class), \' \'), \' ' . $string . ' \')]'; }, |
|
28 | - '[' => function($string) use ($hash) { return '[' .'php:function(\'\Transphporm\Parser\CssToXpath::processAttr\', \'' . $string . '\', ., "' . $hash . '")' . ']'; }, |
|
23 | + ' ' => function($string) use ($prefix) { return '//'.$prefix.$string; }, |
|
24 | + '' => function($string) use ($prefix) { return '/'.$prefix.$string; }, |
|
25 | + '>' => function($string) use ($prefix) { return '/'.$prefix.$string; }, |
|
26 | + '#' => function($string) { return '[@id=\''.$string.'\']'; }, |
|
27 | + '.' => function($string) { return '[contains(concat(\' \', normalize-space(@class), \' \'), \' '.$string.' \')]'; }, |
|
28 | + '[' => function($string) use ($hash) { return '['.'php:function(\'\Transphporm\Parser\CssToXpath::processAttr\', \''.$string.'\', ., "'.$hash.'")'.']'; }, |
|
29 | 29 | ']' => function() { return ''; } |
30 | 30 | ]; |
31 | 31 | } |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | } |
86 | 86 | |
87 | 87 | public function getXpath($css) { |
88 | - $this->css = str_replace([' >', '> '],['>', '>'], trim($css)); |
|
88 | + $this->css = str_replace([' >', '> '], ['>', '>'], trim($css)); |
|
89 | 89 | $css = explode(':', $this->css)[0]; |
90 | 90 | $selectors = $this->split($css); |
91 | 91 | $xpath = '/'; |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | } |
29 | 29 | |
30 | 30 | $selector = trim(substr($this->tss, $pos, $next-$pos)); |
31 | - $pos = strpos($this->tss, '}', $next)+1; |
|
31 | + $pos = strpos($this->tss, '}', $next)+1; |
|
32 | 32 | $newRules = $this->cssToRules($selector, count($rules)+$indexStart, $this->getProperties(trim(substr($this->tss, $next+1, $pos-2-$next)))); |
33 | 33 | $rules = $this->writeRule($rules, $newRules); |
34 | 34 | } |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | private function processingInstructions($tss, $pos, $next, $indexStart) { |
63 | 63 | $rules = []; |
64 | 64 | while (($atPos = strpos($tss, '@', $pos)) !== false) { |
65 | - if ($atPos <= (int) $next) { |
|
65 | + if ($atPos <= (int) $next) { |
|
66 | 66 | $spacePos = strpos($tss, ' ', $atPos); |
67 | 67 | $funcName = substr($tss, $atPos+1, $spacePos-$atPos-1); |
68 | 68 | $pos = strpos($tss, ';', $spacePos); |
@@ -78,9 +78,9 @@ discard block |
||
78 | 78 | } |
79 | 79 | |
80 | 80 | private function import($args, $indexStart) { |
81 | - if (is_file(trim($args,'\'" '))) $fileName = trim($args,'\'" '); |
|
81 | + if (is_file(trim($args, '\'" '))) $fileName = trim($args, '\'" '); |
|
82 | 82 | else $fileName = $this->valueParser->parse($args)[0]; |
83 | - $sheet = new Sheet(file_get_contents($this->baseDir . $fileName), $this->baseDir, $this->xPath, $this->valueParser); |
|
83 | + $sheet = new Sheet(file_get_contents($this->baseDir.$fileName), $this->baseDir, $this->xPath, $this->valueParser); |
|
84 | 84 | return $sheet->parse(0, [], $indexStart); |
85 | 85 | } |
86 | 86 |