Completed
Push — master ( f4ecf6...811ac1 )
by Tom
03:44
created
src/Parser/CssToXpath.php 1 patch
Braces   +10 added lines, -4 removed lines patch added patch discarded remove patch
@@ -43,8 +43,11 @@  discard block
 block discarded – undo
43 43
 					return $valueParser->parse($val, $element[0])[0];
44 44
 				}, $parts);
45 45
 				
46
-				if ($comparator == '=') return $element[0]->getAttribute($parts[0]) == $parts[1];
47
-				else if ($comparator == '!=') return $element[0]->getAttribute($parts[0]) != $parts[1];
46
+				if ($comparator == '=') {
47
+					return $element[0]->getAttribute($parts[0]) == $parts[1];
48
+				} else if ($comparator == '!=') {
49
+					return $element[0]->getAttribute($parts[0]) != $parts[1];
50
+				}
48 51
 			}
49 52
 		}
50 53
 		return $attr;
@@ -61,8 +64,9 @@  discard block
 block discarded – undo
61 64
 				$selector = $this->createSelector();
62 65
 				$selector->type = $css[$i];
63 66
 				$selectors[] = $selector;
67
+			} else {
68
+				$selector->string .= $css[$i];
64 69
 			}
65
-			else $selector->string .= $css[$i];			
66 70
 		}
67 71
 		return $selectors;
68 72
 	}
@@ -73,7 +77,9 @@  discard block
 block discarded – undo
73 77
 		$this->depth = count($selectors);
74 78
 		$xpath = '/';
75 79
 		foreach ($selectors as $selector) {
76
-			if (isset($this->translators[$selector->type])) $xpath .= $this->translators[$selector->type]($selector->string, $xpath);
80
+			if (isset($this->translators[$selector->type])) {
81
+				$xpath .= $this->translators[$selector->type]($selector->string, $xpath);
82
+			}
77 83
 		}
78 84
 
79 85
 		$xpath = str_replace('/[', '/*[', $xpath);
Please login to merge, or discard this patch.