@@ -53,9 +53,9 @@ |
||
53 | 53 | $this->last = $value; |
54 | 54 | } |
55 | 55 | |
56 | - public function makeTraversing() { |
|
57 | - $this->traversing = true; |
|
58 | - } |
|
56 | + public function makeTraversing() { |
|
57 | + $this->traversing = true; |
|
58 | + } |
|
59 | 59 | |
60 | 60 | //Applies the current operation to whatever is in $last based on $mode |
61 | 61 | public function process() { |
@@ -63,8 +63,7 @@ discard block |
||
63 | 63 | try { |
64 | 64 | $value = $this->data->extract($this->last, $this->autoLookup, $this->traversing); |
65 | 65 | $this->result->processValue($value); |
66 | - } |
|
67 | - catch (\UnexpectedValueException $e) { |
|
66 | + } catch (\UnexpectedValueException $e) { |
|
68 | 67 | $this->processLastUnexpected(); |
69 | 68 | } |
70 | 69 | } |
@@ -73,8 +72,7 @@ discard block |
||
73 | 72 | private function processLastUnexpected() { |
74 | 73 | if (!($this->autoLookup || $this->traversing)) { |
75 | 74 | $this->result->processValue($this->last); |
76 | - } |
|
77 | - else { |
|
75 | + } else { |
|
78 | 76 | $this->result->clear(); |
79 | 77 | $this->result->processValue(false); |
80 | 78 | } |
@@ -148,7 +148,7 @@ |
||
148 | 148 | } |
149 | 149 | else $parsedVal = null; |
150 | 150 | |
151 | - $this->result->postProcess($this->data, $val, $parsedVal, $this->allowNullResult); |
|
151 | + $this->result->postProcess($this->data, $val, $parsedVal, $this->allowNullResult); |
|
152 | 152 | |
153 | 153 | $this->last->clear(); |
154 | 154 | } |
@@ -85,7 +85,7 @@ |
||
85 | 85 | if ($lastResult) { |
86 | 86 | $this->last->makeTraversing(); |
87 | 87 | } |
88 | - else if ($this->last->isEmpty()) { |
|
88 | + else if ($this->last->isEmpty()) { |
|
89 | 89 | $this->processString(['value' => '.']); |
90 | 90 | $this->result->setMode(Tokenizer::CONCAT); |
91 | 91 | } |
@@ -56,7 +56,9 @@ discard block |
||
56 | 56 | $this->last = new Last($this->data, $this->result, $this->autoLookup); |
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->last->makeTraversing(); |
87 | - } |
|
88 | - else if ($this->last->isEmpty()) { |
|
89 | + } else if ($this->last->isEmpty()) { |
|
89 | 90 | $this->processString(['value' => '.']); |
90 | 91 | $this->result->setMode(Tokenizer::CONCAT); |
91 | 92 | } |
@@ -100,11 +101,12 @@ discard block |
||
100 | 101 | private function processSquareBracket($token) { |
101 | 102 | if ($this->hasFunction($this->last->read())) { |
102 | 103 | $this->callTransphpormFunctions($token); |
103 | - } |
|
104 | - else { |
|
104 | + } else { |
|
105 | 105 | $this->last->traverse(); |
106 | 106 | $this->last->set($this->getNewParser()->parseTokens($token['value'], null)[0]); |
107 | - if (!is_bool($this->last->read())) $this->last->makeTraversing(); |
|
107 | + if (!is_bool($this->last->read())) { |
|
108 | + $this->last->makeTraversing(); |
|
109 | + } |
|
108 | 110 | } |
109 | 111 | } |
110 | 112 | |
@@ -127,8 +129,7 @@ discard block |
||
127 | 129 | if ($this->hasFunction($this->last->read()) |
128 | 130 | && !$this->data->methodExists($this->last->read())) { |
129 | 131 | $this->callTransphpormFunctions($token); |
130 | - } |
|
131 | - else { |
|
132 | + } else { |
|
132 | 133 | $this->last->processNested($this->getNewParser(), $token); |
133 | 134 | } |
134 | 135 | } |
@@ -145,8 +146,9 @@ discard block |
||
145 | 146 | $parser = new Value($this->data->getData()); |
146 | 147 | $parsedArr = $parser->parse($val); |
147 | 148 | $parsedVal = isset($parsedArr[0]) ? $parsedArr[0] : null; |
149 | + } else { |
|
150 | + $parsedVal = null; |
|
148 | 151 | } |
149 | - else $parsedVal = null; |
|
150 | 152 | |
151 | 153 | $this->result->postProcess($this->data, $val, $parsedVal, $this->allowNullResult); |
152 | 154 |