@@ 189-222 (lines=34) @@ | ||
186 | $this->interpretSourceAsScope($sourceExpression); |
|
187 | } |
|
188 | ||
189 | final protected function visitOffsetUnset(O\Expression $expression) |
|
190 | { |
|
191 | $operationId = $this->getId('offset-unset'); |
|
192 | $indexId = $this->getId('unset-index'); |
|
193 | if ($expression instanceof O\MethodCallExpression) { |
|
194 | $this->interpretation->interpretOffsetUnset( |
|
195 | $operationId, |
|
196 | $indexId, |
|
197 | $this->getArgumentValueAt(0, $expression) |
|
198 | ); |
|
199 | $this->interpretSourceAsScope($expression); |
|
200 | ||
201 | return; |
|
202 | } elseif ($expression instanceof O\UnsetExpression) { |
|
203 | $unsetArguments = $expression->getValues(); |
|
204 | ||
205 | if (count($unsetArguments) === 1 && $unsetArguments[0] instanceof O\IndexExpression) { |
|
206 | $this->interpretation->interpretOffsetUnset( |
|
207 | $operationId, |
|
208 | $indexId, |
|
209 | $this->getValue($unsetArguments[0]->getIndex()) |
|
210 | ); |
|
211 | $this->interpretSourceAsScope($unsetArguments[0]); |
|
212 | ||
213 | return; |
|
214 | } |
|
215 | } |
|
216 | ||
217 | throw new PinqException( |
|
218 | 'Cannot interpret offset unset operation: invalid expression type, expecting %s, %s given', |
|
219 | O\MethodCallExpression::getType() . ' or ' . O\IssetExpression::getType( |
|
220 | ) . ' with a single parameter index', |
|
221 | $expression->getType()); |
|
222 | } |
|
223 | } |
|
224 |
@@ 105-135 (lines=31) @@ | ||
102 | $this->interpretSourceAsScope($expression); |
|
103 | } |
|
104 | ||
105 | final protected function visitOffsetExists(O\Expression $expression) |
|
106 | { |
|
107 | $requestId = $this->getId('offset-exists'); |
|
108 | $indexId = $this->getId('offset-exists-index'); |
|
109 | ||
110 | if ($expression instanceof O\MethodCallExpression) { |
|
111 | $this->interpretation->interpretOffsetExists($requestId, $indexId, $this->getArgumentValueAt(0, $expression)); |
|
112 | $this->interpretSourceAsScope($expression); |
|
113 | ||
114 | return; |
|
115 | } elseif ($expression instanceof O\IssetExpression) { |
|
116 | $issetArguments = $expression->getValues(); |
|
117 | ||
118 | if (count($issetArguments) === 1 && $issetArguments[0] instanceof O\IndexExpression) { |
|
119 | $this->interpretation->interpretOffsetExists( |
|
120 | $requestId, |
|
121 | $indexId, |
|
122 | $this->getValue($issetArguments[0]->getIndex()) |
|
123 | ); |
|
124 | $this->interpretSourceAsScope($issetArguments[0]); |
|
125 | ||
126 | return; |
|
127 | } |
|
128 | } |
|
129 | ||
130 | throw new PinqException( |
|
131 | 'Cannot interpret offset exists request: invalid expression type, expecting %s, %s given', |
|
132 | O\MethodCallExpression::getType() . ' or ' . O\IssetExpression::getType( |
|
133 | ) . ' with a single parameter index', |
|
134 | $expression->getType()); |
|
135 | } |
|
136 | ||
137 | final protected function visitContains(O\MethodCallExpression $expression) |
|
138 | { |