Completed
Pull Request — master (#175)
by Tom
05:04 queued 04:06
created
src/Parser/Tokens.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -87,7 +87,7 @@
 block discarded – undo
87 87
 			if ($token['type'] === $tokenType) $i++;
88 88
 			else $splitTokens[$i][] = $token;
89 89
 		}
90
-		return array_map(function ($tokens) {
90
+		return array_map(function($tokens) {
91 91
 			return new Tokens($tokens);
92 92
 		}, $splitTokens);
93 93
 		//return $splitTokens;
Please login to merge, or discard this patch.
src/Parser/Tokenizer/TokenizedString.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -55,21 +55,21 @@  discard block
 block discarded – undo
55 55
 	}
56 56
 
57 57
 	public function read($offset = 0) {
58
-		return $this->str[$this->pos + $offset];
58
+		return $this->str[$this->pos+$offset];
59 59
 	}
60 60
 
61 61
 	public function identifyChar($offset = 0) {
62
-		$chr = $this->str[$this->pos + $offset];
62
+		$chr = $this->str[$this->pos+$offset];
63 63
 		if (!empty($this->chars[$chr])) return $this->chars[$chr];
64 64
 		else return Tokenizer::NAME;
65 65
 	}
66 66
 
67 67
 	public function has($offset = 0) {
68
-		return isset($this->str[$this->pos + $offset]);
68
+		return isset($this->str[$this->pos+$offset]);
69 69
 	}
70 70
 
71 71
 	public function pos($str) {
72
-		$pos = strpos($this->str,  $str, $this->pos);
72
+		$pos = strpos($this->str, $str, $this->pos);
73 73
 		return $pos ? $pos-$this->pos : false;
74 74
 	}
75 75
 
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
 	}
83 83
 
84 84
 	public function extractString($offset = 0) {
85
-		$pos = $this->pos + $offset;
85
+		$pos = $this->pos+$offset;
86 86
 		$char = $this->str[$pos];
87 87
 		$end = strpos($this->str, $char, $pos+1);
88 88
 		while ($end !== false && $this->str[$end-1] == '\\') $end = strpos($this->str, $char, $end+1);
Please login to merge, or discard this patch.
src/Parser/Tokenizer/Brackets.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@
 block discarded – undo
5 5
 
6 6
 class Brackets implements \Transphporm\Parser\Tokenize {
7 7
 
8
-	private $types =  [
8
+	private $types = [
9 9
 			Tokenizer::OPEN_BRACKET => ['(', ')'],
10 10
 			Tokenizer::OPEN_BRACE => ['{', '}'],
11 11
 			Tokenizer::OPEN_SQUARE_BRACKET => ['[', ']']
Please login to merge, or discard this patch.
src/Parser/Tokenizer/Strings.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@
 block discarded – undo
10 10
 			$chr = $str->read();
11 11
 			$string = $str->extractString();
12 12
 			$length = strlen($string)+1;
13
-			$string = str_replace('\\' . $chr, $chr, $string);
13
+			$string = str_replace('\\'.$chr, $chr, $string);
14 14
 			$tokens->add(['type' => Tokenizer::STRING, 'value' => $string, 'line' => $str->lineNo()]);
15 15
 			$str->move($length);
16 16
 		}
Please login to merge, or discard this patch.
src/Parser/CssToXpath.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -19,13 +19,13 @@  discard block
 block discarded – undo
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
 block discarded – undo
44 44
 		$functionSet->setElement($element[0]);
45 45
 
46 46
 		$attributes = [];
47
-		foreach($element[0]->attributes as $name => $node) {
47
+		foreach ($element[0]->attributes as $name => $node) {
48 48
 			$attributes[$name] = $node->nodeValue;
49 49
 		}
50 50
 
Please login to merge, or discard this patch.