@@ -13,15 +13,15 @@ discard block |
||
13 | 13 | private $valueParser; |
14 | 14 | |
15 | 15 | public function __construct($css, ValueParser $valueParser, $prefix = '') { |
16 | - $this->css = str_replace([' >', '> '],['>', '>'], trim($css)); |
|
16 | + $this->css = str_replace([' >', '> '], ['>', '>'], trim($css)); |
|
17 | 17 | $this->valueParser = $valueParser; |
18 | 18 | $this->translators = [ |
19 | - ' ' => function($string) use ($prefix) { return '//' . $prefix . $string; }, |
|
20 | - '' => function($string) use ($prefix) { return '/' . $prefix . $string; }, |
|
21 | - '>' => function($string) use ($prefix) { return '/' . $prefix . $string; }, |
|
22 | - '#' => function($string) { return '[@id=\'' . $string . '\']'; }, |
|
23 | - '.' => function($string) { return '[contains(concat(\' \', normalize-space(@class), \' \'), \' ' . $string . ' \')]'; }, |
|
24 | - '[' => function($string) { return '[@' . $this->parseAttr($string) . ']'; }, |
|
19 | + ' ' => function($string) use ($prefix) { return '//'.$prefix.$string; }, |
|
20 | + '' => function($string) use ($prefix) { return '/'.$prefix.$string; }, |
|
21 | + '>' => function($string) use ($prefix) { return '/'.$prefix.$string; }, |
|
22 | + '#' => function($string) { return '[@id=\''.$string.'\']'; }, |
|
23 | + '.' => function($string) { return '[contains(concat(\' \', normalize-space(@class), \' \'), \' '.$string.' \')]'; }, |
|
24 | + '[' => function($string) { return '[@'.$this->parseAttr($string).']'; }, |
|
25 | 25 | ']' => function() { return ''; } |
26 | 26 | ]; |
27 | 27 | } |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | $parts = explode($comparator, $attr); |
41 | 41 | |
42 | 42 | foreach ($parts as &$part) $part = implode('', $this->valueParser->parse($part)); |
43 | - if (isset($parts[1])) $parts[1] = '"' . $parts[1] . '"'; |
|
43 | + if (isset($parts[1])) $parts[1] = '"'.$parts[1].'"'; |
|
44 | 44 | return implode($comparator, $parts); |
45 | 45 | } |
46 | 46 | } |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | |
29 | 29 | $selector = trim(substr($this->tss, $pos, $next-$pos)); |
30 | 30 | $rule = $this->cssToRule($selector, count($rules)); |
31 | - $pos = strpos($this->tss, '}', $next)+1; |
|
31 | + $pos = strpos($this->tss, '}', $next)+1; |
|
32 | 32 | $rule->properties = $this->getProperties(trim(substr($this->tss, $next+1, $pos-2-$next))); |
33 | 33 | $rules = $this->writeRule($rules, $selector, $rule); |
34 | 34 | } |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | private function processingInstructions($tss, $pos, $next) { |
55 | 55 | $rules = []; |
56 | 56 | while (($atPos = strpos($tss, '@', $pos)) !== false) { |
57 | - if ($atPos <= (int) $next) { |
|
57 | + if ($atPos <= (int) $next) { |
|
58 | 58 | $spacePos = strpos($tss, ' ', $atPos); |
59 | 59 | $funcName = substr($tss, $atPos+1, $spacePos-$atPos-1); |
60 | 60 | $pos = strpos($tss, ';', $spacePos); |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | } |
71 | 71 | |
72 | 72 | private function import($args) { |
73 | - $sheet = new Sheet(file_get_contents($this->baseDir . trim($args, '\'" ')), $this->baseDir, $this->valueParser, $this->prefix); |
|
73 | + $sheet = new Sheet(file_get_contents($this->baseDir.trim($args, '\'" ')), $this->baseDir, $this->valueParser, $this->prefix); |
|
74 | 74 | return $sheet->parse(); |
75 | 75 | } |
76 | 76 |