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