| Conditions | 7 |
| Paths | 4 |
| Total Lines | 30 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 56 |
| Changes | 2 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 28 | protected function compile($expr, Context $context) |
||
| 29 | { |
||
| 30 | $expression = new Expression($context); |
||
| 31 | $leftCompiledExpression = $expression->compile($expr->expr); |
||
|
|
|||
| 32 | |||
| 33 | $expression = new Expression($context); |
||
| 34 | $rightCompiledExpression = $expression->compile($expr->class); |
||
| 35 | |||
| 36 | if ($leftCompiledExpression->isObject() && $rightCompiledExpression->isObject()) { |
||
| 37 | $leftVariable = $leftCompiledExpression->getVariable(); |
||
| 38 | $rightVariable = $rightCompiledExpression->getVariable(); |
||
| 39 | |||
| 40 | /** |
||
| 41 | * $a = new A(); |
||
| 42 | * $b = $a; |
||
| 43 | * |
||
| 44 | * $a instanceof $b |
||
| 45 | */ |
||
| 46 | if ($leftVariable && $rightVariable) { |
||
| 47 | if ($leftVariable->isReferenced() && $leftVariable->getReferencedTo() instanceof $rightVariable) { |
||
| 48 | return new CompiledExpression(CompiledExpression::BOOLEAN, true); |
||
| 49 | } |
||
| 50 | } |
||
| 51 | } |
||
| 52 | |||
| 53 | /** |
||
| 54 | * Anyway this operator will return BOOLEAN |
||
| 55 | */ |
||
| 56 | return new CompiledExpression(CompiledExpression::BOOLEAN); |
||
| 57 | } |
||
| 58 | } |
||
| 59 |
Very long variable names usually make code harder to read. It is therefore recommended not to make variable names too verbose.