Completed
Push — master ( cad954...477434 )
by Tom
02:53
created
src/Parser/Value.php 1 patch
Braces   +19 added lines, -15 removed lines patch added patch discarded remove patch
@@ -50,7 +50,9 @@  discard block
 block discarded – undo
50 50
 		$this->data = new ValueData($data);
51 51
 		$this->last = null;
52 52
 
53
-		if (empty($tokens)) return [$data];
53
+		if (empty($tokens)) {
54
+			return [$data];
55
+		}
54 56
 
55 57
 		foreach ($tokens as $token) {
56 58
 			$this->{$this->tokenFuncs[$token['type']]}($token);	
@@ -65,8 +67,7 @@  discard block
 block discarded – undo
65 67
 
66 68
 		if ($this->result->getMode() == Tokenizer::NOT && $token['type'] == Tokenizer::EQUALS) {
67 69
 			$this->result->setMode(Tokenizer::NOT);
68
-		}
69
-		else {
70
+		} else {
70 71
 			$this->result->setMode($token['type']);
71 72
 			$this->last = null;
72 73
 		}
@@ -75,8 +76,11 @@  discard block
 block discarded – undo
75 76
 	//Reads the last selected value from $data regardless if it's an array or object and overrides $this->data with the new value
76 77
 	//Dot moves $data to the next object in $data foo.bar moves the $data pointer from `foo` to `bar`
77 78
 	private function processDot($token) {
78
-		if ($this->last !== null) $this->data->traverse($this->last);
79
-		else $this->data = new ValueData($this->result->pop());
79
+		if ($this->last !== null) {
80
+			$this->data->traverse($this->last);
81
+		} else {
82
+			$this->data = new ValueData($this->result->pop());
83
+		}
80 84
 
81 85
 		$this->last = null;
82 86
 	}
@@ -85,9 +89,10 @@  discard block
 block discarded – undo
85 89
 		$parser = new Value($this->baseData, $this->autoLookup);
86 90
 		if ($this->baseData instanceof \Transphporm\Functionset && $this->baseData->hasFunction($this->last)) {
87 91
 			$this->callTransphpormFunctions($token);
88
-		}
89
-		else {
90
-			if ($this->last !== null) $this->data->traverse($this->last);			
92
+		} else {
93
+			if ($this->last !== null) {
94
+				$this->data->traverse($this->last);
95
+			}
91 96
 			$this->last = $parser->parseTokens($token['value'], null)[0];
92 97
 		}
93 98
 	}
@@ -109,8 +114,7 @@  discard block
 block discarded – undo
109 114
 	private function processBrackets($token) {
110 115
 		if ($this->baseData instanceof \Transphporm\Functionset && $this->baseData->hasFunction($this->last)) {
111 116
 			$this->callTransphpormFunctions($token);
112
-		}
113
-		else {
117
+		} else {
114 118
 			$this->processNested($token);
115 119
 		}
116 120
 	}
@@ -127,7 +131,9 @@  discard block
 block discarded – undo
127 131
 		foreach ($this->result->getResult() as $i => $value) {
128 132
 			if (is_scalar($value)) {
129 133
 				$val = $this->data->read($value);
130
-				if ($val) $this->result[$i] = $val;
134
+				if ($val) {
135
+					$this->result[$i] = $val;
136
+				}
131 137
 			}
132 138
 		}
133 139
 		$this->last = null;
@@ -139,12 +145,10 @@  discard block
 block discarded – undo
139 145
 			try {
140 146
 				$value = $this->data->extract($this->last, $this->autoLookup);
141 147
 				$this->result->processValue($value);
142
-			}
143
-			catch (\UnexpectedValueException $e) {
148
+			} catch (\UnexpectedValueException $e) {
144 149
 				if (!$this->autoLookup) {
145 150
 					$this->result->processValue($this->last);
146
-				}
147
-				else {
151
+				} else {
148 152
 					$this->result->clear();
149 153
 					$this->result[0] = false;
150 154
 				}
Please login to merge, or discard this patch.