Completed
Push — master ( aa44e7...3b6d57 )
by Tom
02:09
created
src/Parser/Last.php 1 patch
Braces   +5 added lines, -6 removed lines patch added patch discarded remove patch
@@ -28,8 +28,9 @@  discard block
 block discarded – undo
28 28
 
29 29
 
30 30
 	public function traverse() {
31
-		if ($this->last !== null) $this->data->traverse($this->last);
32
-		else {
31
+		if ($this->last !== null) {
32
+			$this->data->traverse($this->last);
33
+		} else {
33 34
 			$lastResult = $this->result->pop();
34 35
 			if ($lastResult) {
35 36
 				$this->data = new ValueData($lastResult);
@@ -67,8 +68,7 @@  discard block
 block discarded – undo
67 68
 			try {
68 69
 				$value = $this->data->extract($this->last, $this->autoLookup, $this->traversing);
69 70
 				$this->result->processValue($value);
70
-			}
71
-			catch (\UnexpectedValueException $e) {
71
+			} catch (\UnexpectedValueException $e) {
72 72
 				$this->processLastUnexpected();
73 73
 			}
74 74
 		}
@@ -77,8 +77,7 @@  discard block
 block discarded – undo
77 77
 	private function processLastUnexpected() {
78 78
 		if (!($this->autoLookup || $this->traversing)) {
79 79
 			$this->result->processValue($this->last);
80
-		}
81
-		else {
80
+		} else {
82 81
 			$this->result->clear();
83 82
 			$this->result[0] = false;
84 83
 		}
Please login to merge, or discard this patch.
src/Parser/CssToXpath.php 2 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -43,11 +43,11 @@
 block discarded – undo
43 43
 		$functionSet->setElement($element[0]);
44 44
 
45 45
 		$attributes = array();
46
-        foreach($element[0]->attributes as $attribute_name => $attribute_node) {
47
-            $attributes[$attribute_name] = $attribute_node->nodeValue;
48
-        }	
46
+		foreach($element[0]->attributes as $attribute_name => $attribute_node) {
47
+			$attributes[$attribute_name] = $attribute_node->nodeValue;
48
+		}	
49 49
 
50
-        $parser = new \Transphporm\Parser\Value($functionSet, true);
50
+		$parser = new \Transphporm\Parser\Value($functionSet, true);
51 51
 		$return = $parser->parseTokens($attr, $attributes);
52 52
 
53 53
 		return $return[0] === '' ? false : $return[0];
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -19,12 +19,12 @@  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
-			'' => function($string) use ($prefix) { return '/' . $prefix . $string;	},
24
-			Tokenizer::GREATER_THAN => function($string) use ($prefix) { return '/' . $prefix  . $string; },
25
-			Tokenizer::NUM_SIGN => function($string) { return '[@id=\'' . $string . '\']'; },
26
-			Tokenizer::DOT => function($string) { return '[contains(concat(\' \', normalize-space(@class), \' \'), \' ' . $string . ' \')]'; },
27
-			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
+			'' => function($string) use ($prefix) { return '/'.$prefix.$string; },
24
+			Tokenizer::GREATER_THAN => function($string) use ($prefix) { return '/'.$prefix.$string; },
25
+			Tokenizer::NUM_SIGN => function($string) { return '[@id=\''.$string.'\']'; },
26
+			Tokenizer::DOT => function($string) { return '[contains(concat(\' \', normalize-space(@class), \' \'), \' '.$string.' \')]'; },
27
+			Tokenizer::OPEN_SQUARE_BRACKET => function($string) use ($hash) { return '['.'php:function(\'\Transphporm\Parser\CssToXpath::processAttr\', \''.base64_encode(serialize($string)).'\', ., "'.$hash.'")'.']'; }
28 28
 		];
29 29
 	}
30 30
 
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 		$functionSet->setElement($element[0]);
44 44
 
45 45
 		$attributes = array();
46
-        foreach($element[0]->attributes as $attribute_name => $attribute_node) {
46
+        foreach ($element[0]->attributes as $attribute_name => $attribute_node) {
47 47
             $attributes[$attribute_name] = $attribute_node->nodeValue;
48 48
         }	
49 49
 
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 	private function removeSpacesFromDirectDecend($css) {
91 91
 		$tokens = [];
92 92
 		foreach ($css->splitOnToken(Tokenizer::GREATER_THAN) as $token) {
93
-			foreach ($token->trim() as $t) $tokens[]  = $t;
93
+			foreach ($token->trim() as $t) $tokens[] = $t;
94 94
 			$tokens[] = ['type' => Tokenizer::GREATER_THAN];
95 95
 		}
96 96
 		return new Tokens(array_slice($tokens, 0, -1));
Please login to merge, or discard this patch.