@@ -56,7 +56,9 @@ discard block |
||
56 | 56 | $this->last = null; |
57 | 57 | $this->traversing = false; |
58 | 58 | |
59 | - if (count($tokens) <= 0) return [$data]; |
|
59 | + if (count($tokens) <= 0) { |
|
60 | + return [$data]; |
|
61 | + } |
|
60 | 62 | |
61 | 63 | foreach (new TokenFilterIterator($tokens, [Tokenizer::WHITESPACE, Tokenizer::NEW_LINE]) as $token) { |
62 | 64 | $this->{$this->tokenFuncs[$token['type']]}($token); |
@@ -84,8 +86,7 @@ discard block |
||
84 | 86 | // foo.bar is treated as looking up `bar` in `foo` whereas .foo is treated as the string ".foo" |
85 | 87 | if ($lastResult) { |
86 | 88 | $this->traversing = true; |
87 | - } |
|
88 | - else if ($this->last === null) { |
|
89 | + } else if ($this->last === null) { |
|
89 | 90 | $this->processString(['value' => '.']); |
90 | 91 | $this->result->setMode(Tokenizer::CONCAT); |
91 | 92 | } |
@@ -101,11 +102,12 @@ discard block |
||
101 | 102 | $parser = new Value($this->baseData, $this->autoLookup); |
102 | 103 | if ($this->hasFunction($this->last)) { |
103 | 104 | $this->callTransphpormFunctions($token); |
104 | - } |
|
105 | - else { |
|
105 | + } else { |
|
106 | 106 | $this->data->traverse($this->last, $this->result); |
107 | 107 | $this->last = $parser->parseTokens($token['value'], null)[0]; |
108 | - if (!is_bool($this->last)) $this->traversing = true; |
|
108 | + if (!is_bool($this->last)) { |
|
109 | + $this->traversing = true; |
|
110 | + } |
|
109 | 111 | } |
110 | 112 | } |
111 | 113 | |
@@ -128,8 +130,7 @@ discard block |
||
128 | 130 | if ($this->hasFunction($this->last) |
129 | 131 | && !$this->data->methodExists($this->last)) { |
130 | 132 | $this->callTransphpormFunctions($token); |
131 | - } |
|
132 | - else { |
|
133 | + } else { |
|
133 | 134 | $this->processNested($token); |
134 | 135 | } |
135 | 136 | } |
@@ -150,8 +151,7 @@ discard block |
||
150 | 151 | $parsedArr = $parser->parse($val); |
151 | 152 | $parsedVal = isset($parsedArr[0]) ? $parsedArr[0] : null; |
152 | 153 | $this->result->postProcess($this->data, $val, $parsedVal, $this->allowNullResult); |
153 | - } |
|
154 | - else { |
|
154 | + } else { |
|
155 | 155 | $this->result->postProcess($this->data, $val, null, $this->allowNullResult); |
156 | 156 | } |
157 | 157 | |
@@ -164,8 +164,7 @@ discard block |
||
164 | 164 | try { |
165 | 165 | $value = $this->data->extract($this->last, $this->autoLookup, $this->traversing); |
166 | 166 | $this->result->processValue($value); |
167 | - } |
|
168 | - catch (\UnexpectedValueException $e) { |
|
167 | + } catch (\UnexpectedValueException $e) { |
|
169 | 168 | $this->processLastUnexpected(); |
170 | 169 | } |
171 | 170 | } |
@@ -174,8 +173,7 @@ discard block |
||
174 | 173 | private function processLastUnexpected() { |
175 | 174 | if (!($this->autoLookup || $this->traversing)) { |
176 | 175 | $this->result->processValue($this->last); |
177 | - } |
|
178 | - else { |
|
176 | + } else { |
|
179 | 177 | $this->result->clear(); |
180 | 178 | $this->result->processValue(false); |
181 | 179 | } |