Completed
Push — master ( f029dd...2c9e0c )
by Tom
02:33
created
src/Parser/Value.php 1 patch
Braces   +11 added lines, -9 removed lines patch added patch discarded remove patch
@@ -58,7 +58,9 @@  discard block
 block discarded – undo
58 58
 		$this->last = new Last($this->data, $this->result, $this->autoLookup);
59 59
 		$this->traversing = false;
60 60
 
61
-		if (count($tokens) <= 0) return [$data];
61
+		if (count($tokens) <= 0) {
62
+			return [$data];
63
+		}
62 64
 
63 65
 		foreach (new TokenFilterIterator($tokens, [Tokenizer::WHITESPACE, Tokenizer::NEW_LINE]) as $name => $token) {
64 66
 			$this->{$this->tokenFuncs[$token['type']]}($token);
@@ -86,8 +88,7 @@  discard block
 block discarded – undo
86 88
 		// foo.bar is treated as looking up `bar` in `foo` whereas .foo is treated as the string ".foo"
87 89
 		if ($lastResult) {
88 90
 			$this->last->makeTraversing();
89
-		}
90
-		else if ($this->last->isEmpty())  {
91
+		} else if ($this->last->isEmpty())  {
91 92
 			$this->processString(['value' => '.']);
92 93
 			$this->result->setMode(Tokenizer::CONCAT);
93 94
 		}
@@ -102,11 +103,12 @@  discard block
 block discarded – undo
102 103
 	private function processSquareBracket($token) {
103 104
 		if ($this->hasFunction($this->last->read())) {
104 105
 			$this->callTransphpormFunctions($token);
105
-		}
106
-		else {
106
+		} else {
107 107
 			$this->last->traverse();
108 108
 			$this->last->set($this->getNewParser()->parseTokens($token['value'], null)[0]);
109
-			if (!is_bool($this->last->read())) $this->last->makeTraversing();
109
+			if (!is_bool($this->last->read())) {
110
+				$this->last->makeTraversing();
111
+			}
110 112
 		}
111 113
 	}
112 114
 
@@ -129,8 +131,7 @@  discard block
 block discarded – undo
129 131
 		if ($this->hasFunction($this->last->read())
130 132
 			&& !$this->data->methodExists($this->last->read())) {
131 133
 			$this->callTransphpormFunctions($token);
132
-		}
133
-		else {
134
+		} else {
134 135
 			$this->last->processNested($this->getNewParser(), $token);
135 136
 		}
136 137
 	}
@@ -147,8 +148,9 @@  discard block
 block discarded – undo
147 148
 			$parser = new Value($this->data->getData());
148 149
 			$parsedArr = $parser->parse($val);
149 150
 			$parsedVal = isset($parsedArr[0]) ? $parsedArr[0] : null;
151
+		} else {
152
+			$parsedVal = null;
150 153
 		}
151
-		else $parsedVal = null;
152 154
         
153 155
         $this->result->postProcess($this->data, $val, $parsedVal, $this->allowNullResult);
154 156
 
Please login to merge, or discard this patch.
src/TSSFunction/Json.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -17,13 +17,13 @@
 block discarded – undo
17 17
 
18 18
 		if ($this->isJsonFile($json)) {
19 19
 			$path = $this->filePath->getFilePath($json);
20
-			if (!file_exists($path)) throw new \Exception('File does not exist at: ' . $path);
20
+			if (!file_exists($path)) throw new \Exception('File does not exist at: '.$path);
21 21
 			$json = file_get_contents($path);
22 22
 		}
23 23
 
24 24
 		$map = json_decode($json, true);
25 25
 
26
-		if (!is_array($map)) throw new \Exception('Could not decode json: ' . json_last_error_msg());
26
+		if (!is_array($map)) throw new \Exception('Could not decode json: '.json_last_error_msg());
27 27
 
28 28
 		return $map;
29 29
 	}
Please login to merge, or discard this patch.
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -17,13 +17,17 @@
 block discarded – undo
17 17
 
18 18
 		if ($this->isJsonFile($json)) {
19 19
 			$path = $this->filePath->getFilePath($json);
20
-			if (!file_exists($path)) throw new \Exception('File does not exist at: ' . $path);
20
+			if (!file_exists($path)) {
21
+				throw new \Exception('File does not exist at: ' . $path);
22
+			}
21 23
 			$json = file_get_contents($path);
22 24
 		}
23 25
 
24 26
 		$map = json_decode($json, true);
25 27
 
26
-		if (!is_array($map)) throw new \Exception('Could not decode json: ' . json_last_error_msg());
28
+		if (!is_array($map)) {
29
+			throw new \Exception('Could not decode json: ' . json_last_error_msg());
30
+		}
27 31
 
28 32
 		return $map;
29 33
 	}
Please login to merge, or discard this patch.