| 1 |  |  | <?php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 3 |  |  |  * @author Patsura Dmitry https://github.com/ovr <[email protected]> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 4 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 5 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 6 |  |  | namespace PHPSA\Compiler; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 7 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 8 |  |  | use InvalidArgumentException; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 9 |  |  | use PHPSA\Check; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 10 |  |  | use PHPSA\CompiledExpression; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 11 |  |  | use PHPSA\Compiler\Event\ExpressionBeforeCompile; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 12 |  |  | use PHPSA\Context; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 13 |  |  | use PhpParser\Node; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 14 |  |  | use PHPSA\Definition\ClassDefinition; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 15 |  |  | use PHPSA\Exception\RuntimeException; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 16 |  |  | use PHPSA\Variable; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 17 |  |  | use PHPSA\Compiler\Expression\AbstractExpressionCompiler; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 18 |  |  | use Webiny\Component\EventManager\EventManager; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 19 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 20 |  |  | class Expression | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 21 |  |  | { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 22 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 23 |  |  |      * @var Context | 
            
                                                                                                            
                            
            
                                    
            
            
                | 24 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 25 |  |  |     protected $context; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 26 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 27 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 28 |  |  |      * @var EventManager | 
            
                                                                                                            
                            
            
                                    
            
            
                | 29 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 30 |  |  |     protected $eventManager; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 31 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 32 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 33 |  |  |      * @param Context $context | 
            
                                                                                                            
                            
            
                                    
            
            
                | 34 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 35 | 382 |  |     public function __construct(Context $context, EventManager $eventManager) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 36 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 37 | 382 |  |         $this->context = $context; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 38 | 382 |  |         $this->eventManager = $eventManager; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 39 | 382 |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 40 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 41 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 42 |  |  |      * @param $expr | 
            
                                                                                                            
                            
            
                                    
            
            
                | 43 |  |  |      * @return ExpressionCompilerInterface|AbstractExpressionCompiler | 
            
                                                                                                            
                            
            
                                    
            
            
                | 44 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 45 | 369 |  |     protected function factory($expr) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 46 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 47 | 369 |  |         switch (get_class($expr)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 48 |  |  |             /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 49 |  |  |              * Call(s) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 50 |  |  |              */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 51 | 369 |  |             case Node\Expr\MethodCall::class: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 52 |  |  |                 return new Expression\MethodCall(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 53 | 369 |  |             case Node\Expr\FuncCall::class: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 54 | 10 |  |                 return new Expression\FunctionCall(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 55 | 361 |  |             case Node\Expr\StaticCall::class: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 56 |  |  |                 return new Expression\StaticCall(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 57 |  |  |             /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 58 |  |  |              * Operators | 
            
                                                                                                            
                            
            
                                    
            
            
                | 59 |  |  |              */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 60 | 361 |  |             case Node\Expr\New_::class: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 61 | 1 |  |                 return new Expression\Operators\NewOp(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 62 | 360 |  |             case Node\Expr\Instanceof_::class: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 63 |  |  |                 return new Expression\Operators\InstanceOfOp(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 64 |  |  |             /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 65 |  |  |              * AssignOp | 
            
                                                                                                            
                            
            
                                    
            
            
                | 66 |  |  |              */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 67 | 360 |  |             case Node\Expr\AssignOp\Pow::class: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 68 |  |  |                 return new Expression\AssignOp\Pow(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 69 | 360 |  |             case Node\Expr\AssignOp\Plus::class: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 70 |  |  |                 return new Expression\AssignOp\Plus(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 71 | 360 |  |             case Node\Expr\AssignOp\Minus::class: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 72 |  |  |                 return new Expression\AssignOp\Minus(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 73 | 360 |  |             case Node\Expr\AssignOp\Mod::class: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 74 |  |  |                 return new Expression\AssignOp\Mod(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 75 | 360 |  |             case Node\Expr\AssignOp\BitwiseOr::class: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 76 |  |  |                 return new Expression\AssignOp\BitwiseOr(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 77 | 360 |  |             case Node\Expr\AssignOp\BitwiseAnd::class: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 78 |  |  |                 return new Expression\AssignOp\BitwiseAnd(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 79 |  |  |             /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 80 |  |  |              * BinaryOp | 
            
                                                                                                            
                            
            
                                    
            
            
                | 81 |  |  |              */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 82 | 360 |  |             case Node\Expr\BinaryOp\Identical::class: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 83 | 28 |  |                 return new Expression\BinaryOp\Identical(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 84 | 332 |  |             case Node\Expr\BinaryOp\Concat::class: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 85 | 1 |  |                 return new Expression\Operators\Concat(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 86 | 331 |  |             case Node\Expr\BinaryOp\NotIdentical::class: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 87 | 14 |  |                 return new Expression\BinaryOp\NotIdentical(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 88 | 317 |  |             case Node\Expr\BinaryOp\Equal::class: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 89 | 34 |  |                 return new Expression\BinaryOp\Equal(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 90 | 283 |  |             case Node\Expr\BinaryOp\NotEqual::class: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 91 | 17 |  |                 return new Expression\BinaryOp\NotEqual(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 92 |  |  |             /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 93 |  |  |              * @link http://php.net/manual/en/language.operators.increment.php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 94 |  |  |              */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 95 | 266 |  |             case Node\Expr\PostInc::class: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 96 | 4 |  |                 return new Expression\Operators\PostInc(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 97 | 262 |  |             case Node\Expr\PostDec::class: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 98 | 4 |  |                 return new Expression\Operators\PostDec(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 99 |  |  |             /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 100 |  |  |              * Arithmetical | 
            
                                                                                                            
                            
            
                                    
            
            
                | 101 |  |  |              */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 102 | 258 |  |             case Node\Expr\BinaryOp\Div::class: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 103 | 37 |  |                 return new Expression\Operators\Arithmetical\Div(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 104 | 221 |  |             case Node\Expr\BinaryOp\Plus::class: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 105 | 45 |  |                 return new Expression\Operators\Arithmetical\Plus(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 106 | 176 |  |             case Node\Expr\BinaryOp\Minus::class: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 107 | 18 |  |                 return new Expression\Operators\Arithmetical\Minus(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 108 | 158 |  |             case Node\Expr\BinaryOp\Mul::class: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 109 | 35 |  |                 return new Expression\Operators\Arithmetical\Mul(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 110 | 123 |  |             case Node\Expr\BinaryOp\Mod::class: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 111 | 35 |  |                 return new Expression\Operators\Arithmetical\Mod(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 112 |  |  |             /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 113 |  |  |              * Bitwise | 
            
                                                                                                            
                            
            
                                    
            
            
                | 114 |  |  |              * @link http://php.net/manual/ru/language.operators.bitwise.php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 115 |  |  |              */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 116 | 88 |  |             case Node\Expr\BinaryOp\BitwiseOr::class: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 117 |  |  |                 return new Expression\Operators\Bitwise\BitwiseOr(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 118 | 88 |  |             case Node\Expr\BinaryOp\BitwiseXor::class: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 119 |  |  |                 return new Expression\Operators\Bitwise\BitwiseXor(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 120 | 88 |  |             case Node\Expr\BinaryOp\BitwiseAnd::class: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 121 |  |  |                 return new Expression\Operators\Bitwise\BitwiseAnd(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 122 | 88 |  |             case Node\Expr\BinaryOp\ShiftRight::class: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 123 |  |  |                 return new Expression\Operators\Bitwise\ShiftRight(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 124 | 88 |  |             case Node\Expr\BinaryOp\ShiftLeft::class: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 125 |  |  |                 return new Expression\Operators\Bitwise\ShiftLeft(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 126 | 88 |  |             case Node\Expr\BitwiseNot::class: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 127 |  |  |                 return new Expression\Operators\Bitwise\BitwiseNot(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 128 |  |  |             /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 129 |  |  |              * Logical | 
            
                                                                                                            
                            
            
                                    
            
            
                | 130 |  |  |              */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 131 | 88 |  |             case Node\Expr\BinaryOp\BooleanOr::class: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 132 | 10 |  |                 return new Expression\Operators\Logical\BooleanOr(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 133 | 78 |  |             case Node\Expr\BinaryOp\BooleanAnd::class: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 134 | 5 |  |                 return new Expression\Operators\Logical\BooleanAnd(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 135 | 73 |  |             case Node\Expr\BooleanNot::class: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 136 | 5 |  |                 return new Expression\Operators\Logical\BooleanNot(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 137 |  |  |             /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 138 |  |  |              * Comparison | 
            
                                                                                                            
                            
            
                                    
            
            
                | 139 |  |  |              */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 140 | 68 |  |             case Node\Expr\BinaryOp\Greater::class: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 141 | 12 |  |                 return new Expression\Operators\Comparison\Greater(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 142 | 56 |  |             case Node\Expr\BinaryOp\GreaterOrEqual::class: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 143 | 12 |  |                 return new Expression\Operators\Comparison\GreaterOrEqual(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 144 | 44 |  |             case Node\Expr\BinaryOp\Smaller::class: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 145 | 12 |  |                 return new Expression\Operators\Comparison\Smaller(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 146 | 32 |  |             case Node\Expr\BinaryOp\SmallerOrEqual::class: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 147 | 12 |  |                 return new Expression\Operators\Comparison\SmallerOrEqual(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 148 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 149 |  |  |             /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 150 |  |  |              * Casts | 
            
                                                                                                            
                            
            
                                    
            
            
                | 151 |  |  |              */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 152 | 20 |  |             case Node\Expr\Cast\Array_::class: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 153 | 1 |  |                 return new Expression\Casts\ArrayCast(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 154 | 20 |  |             case Node\Expr\Cast\Bool_::class: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 155 | 1 |  |                 return new Expression\Casts\BoolCast(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 156 | 20 |  |             case Node\Expr\Cast\Int_::class: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 157 | 1 |  |                 return new Expression\Casts\IntCast(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 158 | 20 |  |             case Node\Expr\Cast\Double::class: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 159 | 1 |  |                 return new Expression\Casts\DoubleCast(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 160 | 20 |  |             case Node\Expr\Cast\Object_::class: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 161 | 1 |  |                 return new Expression\Casts\ObjectCast(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 162 | 20 |  |             case Node\Expr\Cast\String_::class: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 163 | 1 |  |                 return new Expression\Casts\StringCast(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 164 | 20 |  |             case Node\Expr\Cast\Unset_::class: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 165 | 1 |  |                 return new Expression\Casts\UnsetCast(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 166 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 167 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 168 |  |  |             /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 169 |  |  |              * Other | 
            
                                                                                                            
                            
            
                                    
            
            
                | 170 |  |  |              */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 171 | 19 |  |             case Node\Expr\Closure::class: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 172 |  |  |                 return new Expression\Closure(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 173 | 19 |  |             case Node\Expr\UnaryMinus::class: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 174 | 9 |  |                 return new Expression\Operators\UnaryMinus(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 175 | 10 |  |             case Node\Expr\UnaryPlus::class: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 176 | 9 |  |                 return new Expression\Operators\UnaryPlus(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 177 | 1 |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 178 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 179 | 1 |  |         return false; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 180 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 181 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 182 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 183 |  |  |      * @param object|string $expr | 
            
                                                                                                            
                            
            
                                    
            
            
                | 184 |  |  |      * @return CompiledExpression | 
            
                                                                                                            
                            
            
                                    
            
            
                | 185 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 186 | 382 |  |     public function compile($expr) | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 187 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 188 | 382 |  |         if (is_string($expr)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 189 | 1 |  |             return new CompiledExpression(CompiledExpression::STRING, $expr); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 190 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 191 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 192 | 382 |  |         if (is_null($expr)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 193 | 1 |  |             return new CompiledExpression(CompiledExpression::NULL); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 194 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 195 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 196 | 382 |  |         if (!is_object($expr)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 197 |  |  |             throw new InvalidArgumentException('$expr must be string/object/null'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 198 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 199 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 200 | 382 |  |         $this->eventManager->fire( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 201 | 382 |  |             ExpressionBeforeCompile::EVENT_NAME, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 202 | 382 |  |             new ExpressionBeforeCompile( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 203 | 382 |  |                 $expr, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 204 | 382 |  |                 $this->context | 
            
                                                                                                            
                            
            
                                    
            
            
                | 205 | 382 |  |             ) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 206 | 382 |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 207 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 208 | 382 |  |         $className = get_class($expr); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 209 |  |  |         switch ($className) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 210 | 382 |  |             case Node\Arg::class: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 211 |  |  |                 /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 212 |  |  |                  * @todo Better compile | 
            
                                                                                                            
                            
            
                                    
            
            
                | 213 |  |  |                  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 214 | 2 |  |                 return $this->compile($expr->value); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 215 | 382 |  |             case Node\Expr\PropertyFetch::class: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 216 |  |  |                 return $this->passPropertyFetch($expr); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 217 | 382 |  |             case Node\Stmt\Property::class: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 218 |  |  |                 return $this->passProperty($expr); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 219 | 382 |  |             case Node\Expr\ClassConstFetch::class: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 220 |  |  |                 return $this->passConstFetch($expr); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 221 | 382 |  |             case Node\Expr\Assign::class: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 222 | 8 |  |                 return $this->passSymbol($expr); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 223 | 382 |  |             case Node\Expr\AssignRef::class: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 224 | 1 |  |                 return $this->passSymbolByRef($expr); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 225 | 382 |  |             case Node\Expr\Variable::class: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 226 | 5 |  |                 return $this->passExprVariable($expr); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 227 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 228 |  |  |             /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 229 |  |  |              * Expressions | 
            
                                                                                                            
                            
            
                                    
            
            
                | 230 |  |  |              */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 231 | 382 |  |             case Node\Expr\Array_::class: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 232 | 16 |  |                 return $this->getArray($expr); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 233 | 381 |  |             case Node\Expr\ConstFetch::class: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 234 | 5 |  |                 return $this->constFetch($expr); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 235 | 381 |  |             case Node\Name::class: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 236 | 11 |  |                 return $this->getNodeName($expr); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 237 | 381 |  |             case Node\Name\FullyQualified::class: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 238 |  |  |                 return $this->getFullyQualifiedNodeName($expr); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 239 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 240 |  |  |             /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 241 |  |  |              * Simple Scalar(s) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 242 |  |  |              */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 243 | 381 |  |             case \PHPSA\Node\Scalar\Nil::class: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 244 | 8 |  |                 return new CompiledExpression(CompiledExpression::NULL); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 245 | 380 |  |             case Node\Scalar\LNumber::class: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 246 | 270 |  |                 return new CompiledExpression(CompiledExpression::INTEGER, $expr->value); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 247 | 375 |  |             case Node\Scalar\DNumber::class: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 248 | 132 |  |                 return new CompiledExpression(CompiledExpression::DOUBLE, $expr->value); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 249 | 374 |  |             case Node\Scalar\String_::class: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 250 | 16 |  |                 return new CompiledExpression(CompiledExpression::STRING, $expr->value); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 251 | 371 |  |             case \PHPSA\Node\Scalar\Boolean::class: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 252 | 60 |  |                 return new CompiledExpression(CompiledExpression::BOOLEAN, $expr->value); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 253 | 369 |  |             case \PHPSA\Node\Scalar\Fake::class: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 254 | 29 |  |                 return new CompiledExpression($expr->type, $expr->value); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 255 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 256 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 257 | 369 |  |         $expressionCompiler = $this->factory($expr); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 258 | 369 |  |         if (!$expressionCompiler) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 259 | 1 |  |             $this->context->debug("Expression compiler is not implemented for {$className}"); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 260 | 1 |  |             return new CompiledExpression(CompiledExpression::UNIMPLEMENTED); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 261 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 262 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 263 | 369 |  |         $result = $expressionCompiler->pass($expr, $this->context); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 264 | 369 |  |         if (!$result instanceof CompiledExpression) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 265 |  |  |             throw new RuntimeException('Please return CompiledExpression from ' . get_class($expressionCompiler)); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 266 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 267 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 268 | 369 |  |         return $result; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 269 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 270 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 271 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 272 |  |  |      * @todo Implement | 
            
                                                                                                            
                            
            
                                    
            
            
                | 273 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 274 |  |  |      * @param Node\Stmt\Property $st | 
            
                                                                                                            
                            
            
                                    
            
            
                | 275 |  |  |      * @return CompiledExpression | 
            
                                                                                                            
                            
            
                                    
            
            
                | 276 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 277 |  |  |     public function passProperty(Node\Stmt\Property $st) | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 278 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 279 |  |  |         $docBlock = $st->getDocComment(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 280 |  |  |         if (!$docBlock) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 281 |  |  |             $this->context->notice( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 282 |  |  |                 'missing-docblock', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 283 |  |  |                 sprintf('Missing docblock for $%s property', $st->props[0]->name), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 284 |  |  |                 $st | 
            
                                                                                                            
                            
            
                                    
            
            
                | 285 |  |  |             ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 286 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 287 |  |  |             return new CompiledExpression(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 288 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 289 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 290 |  |  |         $phpdoc = new \phpDocumentor\Reflection\DocBlock($docBlock->getText()); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 291 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 292 |  |  |         $varTags = $phpdoc->getTagsByName('var'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 293 |  |  |         if ($varTags) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 294 |  |  |             /** @var \phpDocumentor\Reflection\DocBlock\Tag\VarTag $varTag */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 295 |  |  |             $varTag = current($varTags); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 296 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 297 |  |  |             $typeResolver = new \phpDocumentor\Reflection\TypeResolver(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 298 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 299 |  |  |             try { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 300 |  |  |                 $type = $typeResolver->resolve($varTag->getType()); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 301 |  |  |             } catch (\InvalidArgumentException $e) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 302 |  |  |                 return new CompiledExpression(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 303 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 304 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 305 |  |  |             if ($type) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 306 |  |  |                 switch (get_class($type)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 307 |  |  |                     case \phpDocumentor\Reflection\Types\Object_::class: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 308 |  |  |                         return new CompiledExpression( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 309 |  |  |                             CompiledExpression::OBJECT | 
            
                                                                                                            
                            
            
                                    
            
            
                | 310 |  |  |                         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 311 |  |  |                     case \phpDocumentor\Reflection\Types\Integer::class: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 312 |  |  |                         return new CompiledExpression( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 313 |  |  |                             CompiledExpression::INTEGER | 
            
                                                                                                            
                            
            
                                    
            
            
                | 314 |  |  |                         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 315 |  |  |                     case \phpDocumentor\Reflection\Types\String_::class: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 316 |  |  |                         return new CompiledExpression( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 317 |  |  |                             CompiledExpression::STRING | 
            
                                                                                                            
                            
            
                                    
            
            
                | 318 |  |  |                         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 319 |  |  |                     case \phpDocumentor\Reflection\Types\Float_::class: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 320 |  |  |                         return new CompiledExpression( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 321 |  |  |                             CompiledExpression::DOUBLE | 
            
                                                                                                            
                            
            
                                    
            
            
                | 322 |  |  |                         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 323 |  |  |                     case \phpDocumentor\Reflection\Types\Null_::class: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 324 |  |  |                         return new CompiledExpression( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 325 |  |  |                             CompiledExpression::NULL | 
            
                                                                                                            
                            
            
                                    
            
            
                | 326 |  |  |                         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 327 |  |  |                     case \phpDocumentor\Reflection\Types\Boolean::class: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 328 |  |  |                         return new CompiledExpression( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 329 |  |  |                             CompiledExpression::BOOLEAN | 
            
                                                                                                            
                            
            
                                    
            
            
                | 330 |  |  |                         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 331 |  |  |                 } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 332 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 333 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 334 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 335 |  |  |         return new CompiledExpression(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 336 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 337 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 338 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 339 |  |  |      * @param Node\Expr\Variable $expr | 
            
                                                                                                            
                            
            
                                    
            
            
                | 340 |  |  |      * @return CompiledExpression | 
            
                                                                                                            
                            
            
                                    
            
            
                | 341 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 342 | 1 |  |     public function declareVariable(Node\Expr\Variable $expr) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 343 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 344 | 1 |  |         $variable = $this->context->getSymbol($expr->name); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 345 | 1 |  |         if (!$variable) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 346 |  |  |             $variable = new Variable($expr->name, null, CompiledExpression::UNKNOWN, $this->context->getCurrentBranch()); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 347 |  |  |             $this->context->addVariable($variable); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 348 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 349 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 350 | 1 |  |         return new CompiledExpression($variable->getType(), $variable->getValue(), $variable); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 351 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 352 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 353 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 354 |  |  |      * @param Node\Name\FullyQualified $expr | 
            
                                                                                                            
                            
            
                                    
            
            
                | 355 |  |  |      * @return CompiledExpression | 
            
                                                                                                            
                            
            
                                    
            
            
                | 356 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 357 |  |  |     public function getFullyQualifiedNodeName(Node\Name\FullyQualified $expr) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 358 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 359 |  |  |         $this->context->debug('Unimplemented FullyQualified', $expr); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 360 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 361 |  |  |         return new CompiledExpression; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 362 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 363 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 364 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 365 |  |  |      * @param Node\Name $expr | 
            
                                                                                                            
                            
            
                                    
            
            
                | 366 |  |  |      * @return CompiledExpression | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 367 |  |  |      */ | 
            
                                                                        
                            
            
                                    
            
            
                | 368 | 11 |  |     public function getNodeName(Node\Name $expr) | 
            
                                                                        
                            
            
                                    
            
            
                | 369 |  |  |     { | 
            
                                                                        
                            
            
                                    
            
            
                | 370 | 11 |  |         $nodeString = $expr->toString(); | 
            
                                                                        
                            
            
                                    
            
            
                | 371 | 11 |  |         if ($nodeString === 'null') { | 
            
                                                                        
                            
            
                                    
            
            
                | 372 | 1 |  |             return new CompiledExpression(CompiledExpression::NULL); | 
            
                                                                        
                            
            
                                    
            
            
                | 373 |  |  |         } | 
            
                                                                        
                            
            
                                    
            
            
                | 374 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 375 | 10 |  |         if (in_array($nodeString, ['parent'], true)) { | 
            
                                                                        
                            
            
                                    
            
            
                | 376 |  |  |             /** @var ClassDefinition $scope */ | 
            
                                                                        
                            
            
                                    
            
            
                | 377 |  |  |             $scope = $this->context->scope; | 
            
                                                                        
                            
            
                                    
            
            
                | 378 |  |  |             assert($scope instanceof ClassDefinition); | 
            
                                                                        
                            
            
                                    
            
            
                | 379 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 380 |  |  |             if ($scope->getExtendsClass()) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                        
                            
            
                                    
            
            
                | 381 |  |  |                 $definition = $scope->getExtendsClassDefinition(); | 
            
                                                                        
                            
            
                                    
            
            
                | 382 |  |  |                 if ($definition) { | 
            
                                                                        
                            
            
                                    
            
            
                | 383 |  |  |                     return new CompiledExpression(CompiledExpression::OBJECT, $definition); | 
            
                                                                        
                            
            
                                    
            
            
                | 384 |  |  |                 } | 
            
                                                                        
                            
            
                                    
            
            
                | 385 |  |  |             } else { | 
            
                                                                        
                            
            
                                    
            
            
                | 386 |  |  |                 $this->context->notice( | 
            
                                                                        
                            
            
                                    
            
            
                | 387 |  |  |                     'no-parent', | 
            
                                                                        
                            
            
                                    
            
            
                | 388 |  |  |                     'Cannot access parent:: when current class scope has no parent', | 
            
                                                                        
                            
            
                                    
            
            
                | 389 |  |  |                     $expr | 
            
                                                                        
                            
            
                                    
            
            
                | 390 |  |  |                 ); | 
            
                                                                        
                            
            
                                    
            
            
                | 391 |  |  |             } | 
            
                                                                        
                            
            
                                    
            
            
                | 392 |  |  |         } | 
            
                                                                        
                            
            
                                    
            
            
                | 393 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 394 | 10 |  |         if (in_array($nodeString, ['self', 'static'], true)) { | 
            
                                                                        
                            
            
                                    
            
            
                | 395 |  |  |             return CompiledExpression::fromZvalValue($this->context->scope); | 
            
                                                                        
                            
            
                                    
            
            
                | 396 |  |  |         } | 
            
                                                                        
                            
            
                                    
            
            
                | 397 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 398 | 10 |  |         if (defined($nodeString)) { | 
            
                                                                        
                            
            
                                    
            
            
                | 399 | 1 |  |             return CompiledExpression::fromZvalValue(constant($expr)); | 
            
                                                                        
                            
            
                                    
            
            
                | 400 |  |  |         } | 
            
                                                                        
                            
            
                                    
            
            
                | 401 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 402 | 10 |  |         return new CompiledExpression(CompiledExpression::STRING, $expr->toString()); | 
            
                                                                        
                            
            
                                    
            
            
                | 403 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 404 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 405 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 406 |  |  |      * @param Node\Expr\PropertyFetch $expr | 
            
                                                                                                            
                            
            
                                    
            
            
                | 407 |  |  |      * @return CompiledExpression | 
            
                                                                                                            
                            
            
                                    
            
            
                | 408 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 409 |  |  |     protected function passPropertyFetch(Node\Expr\PropertyFetch $expr) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 410 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 411 |  |  |         $propertNameCE = $this->compile($expr->name); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 412 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 413 |  |  |         $scopeExpression = $this->compile($expr->var); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 414 |  |  |         if ($scopeExpression->isObject()) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 415 |  |  |             $scopeExpressionValue = $scopeExpression->getValue(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 416 |  |  |             if ($scopeExpressionValue instanceof ClassDefinition) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 417 |  |  |                 $propertyName = $propertNameCE->isString() ? $propertNameCE->getValue() : false; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 418 |  |  |                 if ($propertyName) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 419 |  |  |                     if ($scopeExpressionValue->hasProperty($propertyName, true)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 420 |  |  |                         $property = $scopeExpressionValue->getProperty($propertyName, true); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 421 |  |  |                         return $this->compile($property); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 422 |  |  |                     } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 423 |  |  |                         $this->context->notice( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 424 |  |  |                             'undefined-property', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 425 |  |  |                             sprintf( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 426 |  |  |                                 'Property %s does not exist in %s scope', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 427 |  |  |                                 $propertyName, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 428 |  |  |                                 $scopeExpressionValue->getName() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 429 |  |  |                             ), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 430 |  |  |                             $expr | 
            
                                                                                                            
                            
            
                                    
            
            
                | 431 |  |  |                         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 432 |  |  |                     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 433 |  |  |                 } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 434 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 435 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 436 |  |  |             return new CompiledExpression(CompiledExpression::UNKNOWN); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 437 |  |  |         } elseif (!$scopeExpression->canBeObject()) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 438 |  |  |             return new CompiledExpression(CompiledExpression::UNKNOWN); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 439 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 440 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 441 |  |  |         $this->context->notice( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 442 |  |  |             'property-fetch-on-non-object', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 443 |  |  |             "It's not possible to fetch property on not object", | 
            
                                                                                                            
                            
            
                                    
            
            
                | 444 |  |  |             $expr, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 445 |  |  |             Check::CHECK_BETA | 
            
                                                                                                            
                            
            
                                    
            
            
                | 446 |  |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 447 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 448 |  |  |         return new CompiledExpression(CompiledExpression::UNKNOWN); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 449 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 450 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 451 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 452 |  |  |      * @param Node\Expr\ClassConstFetch $expr | 
            
                                                                                                            
                            
            
                                    
            
            
                | 453 |  |  |      * @return CompiledExpression | 
            
                                                                                                            
                            
            
                                    
            
            
                | 454 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 455 |  |  |     protected function passConstFetch(Node\Expr\ClassConstFetch $expr) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 456 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 457 |  |  |         $leftCE = $this->compile($expr->class); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 458 |  |  |         if ($leftCE->isObject()) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 459 |  |  |             $leftCEValue = $leftCE->getValue(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 460 |  |  |             if ($leftCEValue instanceof ClassDefinition) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 461 |  |  |                 if (!$leftCEValue->hasConst($expr->name, true)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 462 |  |  |                     $this->context->notice( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 463 |  |  |                         'undefined-const', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 464 |  |  |                         sprintf('Constant %s does not exist in %s scope', $expr->name, $expr->class), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 465 |  |  |                         $expr | 
            
                                                                                                            
                            
            
                                    
            
            
                | 466 |  |  |                     ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 467 |  |  |                     return new CompiledExpression(CompiledExpression::UNKNOWN); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 468 |  |  |                 } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 469 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 470 |  |  |                 return new CompiledExpression(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 471 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 472 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 473 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 474 |  |  |         $this->context->debug('Unknown const fetch', $expr); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 475 |  |  |         return new CompiledExpression(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 476 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 477 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 478 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 479 |  |  |      * @param Node\Expr\Assign $expr | 
            
                                                                                                            
                            
            
                                    
            
            
                | 480 |  |  |      * @return CompiledExpression | 
            
                                                                                                            
                            
            
                                    
            
            
                | 481 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 482 | 8 |  |     protected function passSymbol(Node\Expr\Assign $expr) | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 483 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 484 | 8 |  |         $compiledExpression = $this->compile($expr->expr); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 485 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 486 | 8 |  |         if ($expr->var instanceof Node\Expr\List_) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 487 |  |  |             $isCorrectType = false; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 488 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 489 |  |  |             switch ($compiledExpression->getType()) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 490 |  |  |                 case CompiledExpression::ARR: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 491 |  |  |                     $isCorrectType = true; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 492 |  |  |                     break; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 493 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 494 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 495 |  |  |             if ($expr->var->vars) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 496 |  |  |                 foreach ($expr->var->vars as $key => $var) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 497 |  |  |                     if ($var instanceof Node\Expr\Variable) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 498 |  |  |                         if (!isset($expr->var->name)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 499 |  |  |                             var_dump($var); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 500 |  |  |                         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 501 |  |  |                         $name = $expr->var->name; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 502 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 503 |  |  |                         $symbol = $this->context->getSymbol($name); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 504 |  |  |                         if (!$symbol) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 505 |  |  |                             $symbol = new Variable( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 506 |  |  |                                 $name, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 507 |  |  |                                 null, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 508 |  |  |                                 CompiledExpression::UNKNOWN, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 509 |  |  |                                 $this->context->getCurrentBranch() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 510 |  |  |                             ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 511 |  |  |                             $this->context->addVariable($symbol); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 512 |  |  |                         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 513 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 514 |  |  |                         if (!$isCorrectType) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 515 |  |  |                             $symbol->modify(CompiledExpression::NULL, null); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 516 |  |  |                         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 517 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 518 |  |  |                         $symbol->incSets(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 519 |  |  |                     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 520 |  |  |                 } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 521 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 522 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 523 |  |  |             return new CompiledExpression(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 524 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 525 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 526 | 8 |  |         if ($expr->var instanceof Node\Expr\Variable) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 527 | 8 |  |             $name = $expr->var->name; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 528 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 529 | 8 |  |             $symbol = $this->context->getSymbol($name); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 530 | 8 |  |             if ($symbol) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 531 | 2 |  |                 $symbol->modify($compiledExpression->getType(), $compiledExpression->getValue()); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 532 | 2 |  |                 $this->context->modifyReferencedVariables( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 533 | 2 |  |                     $symbol, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 534 | 2 |  |                     $compiledExpression->getType(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 535 | 2 |  |                     $compiledExpression->getValue() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 536 | 2 |  |                 ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 537 | 2 |  |             } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 538 | 8 |  |                 $symbol = new Variable( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 539 | 8 |  |                     $name, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 540 | 8 |  |                     $compiledExpression->getValue(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 541 | 8 |  |                     $compiledExpression->getType(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 542 | 8 |  |                     $this->context->getCurrentBranch() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 543 | 8 |  |                 ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 544 | 8 |  |                 $this->context->addVariable($symbol); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 545 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 546 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 547 | 8 |  |             $symbol->incSets(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 548 | 8 |  |             return $compiledExpression; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 549 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 550 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 551 |  |  |         if ($expr->var instanceof Node\Expr\PropertyFetch) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 552 |  |  |             $compiledExpression = $this->compile($expr->var->var); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 553 |  |  |             if ($compiledExpression->getType() == CompiledExpression::OBJECT) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 554 |  |  |                 $objectDefinition = $compiledExpression->getValue(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 555 |  |  |                 if ($objectDefinition instanceof ClassDefinition) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 556 |  |  |                     if (is_string($expr->var->name)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 557 |  |  |                         if ($objectDefinition->hasProperty($expr->var->name)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 558 |  |  |                             return $this->compile($objectDefinition->getProperty($expr->var->name)); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 559 |  |  |                         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 560 |  |  |                     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 561 |  |  |                 } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 562 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 563 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 564 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 565 |  |  |         $this->context->debug('Unknown how to pass symbol'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 566 |  |  |         return new CompiledExpression(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 567 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 568 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 569 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 570 |  |  |      * @param Node\Expr\AssignRef $expr | 
            
                                                                                                            
                            
            
                                    
            
            
                | 571 |  |  |      * @return CompiledExpression | 
            
                                                                                                            
                            
            
                                    
            
            
                | 572 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 573 | 1 |  |     protected function passSymbolByRef(Node\Expr\AssignRef $expr) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 574 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 575 | 1 |  |         if ($expr->var instanceof Node\Expr\Variable) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 576 | 1 |  |             $name = $expr->var->name; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 577 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 578 | 1 |  |             $compiledExpression = $this->compile($expr->expr); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 579 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 580 | 1 |  |             $symbol = $this->context->getSymbol($name); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 581 | 1 |  |             if ($symbol) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 582 |  |  |                 $symbol->modify($compiledExpression->getType(), $compiledExpression->getValue()); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 583 |  |  |             } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 584 | 1 |  |                 $symbol = new Variable( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 585 | 1 |  |                     $name, | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 586 | 1 |  |                     $compiledExpression->getValue(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 587 | 1 |  |                     $compiledExpression->getType(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 588 | 1 |  |                     $this->context->getCurrentBranch() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 589 | 1 |  |                 ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 590 | 1 |  |                 $this->context->addVariable($symbol); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 591 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 592 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 593 | 1 |  |             if ($expr->expr instanceof Node\Expr\Variable) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 594 | 1 |  |                 $rightVarName = $expr->expr->name; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 595 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 596 | 1 |  |                 $rightSymbol = $this->context->getSymbol($rightVarName); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 597 | 1 |  |                 if ($rightSymbol) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 598 | 1 |  |                     $rightSymbol->incUse(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 599 | 1 |  |                     $symbol->setReferencedTo($rightSymbol); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 600 | 1 |  |                 } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 601 |  |  |                     $this->context->debug('Cannot fetch variable by name: ' . $rightVarName); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 602 |  |  |                 } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 603 | 1 |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 604 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 605 | 1 |  |             $symbol->incSets(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 606 | 1 |  |             return $compiledExpression; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 607 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 608 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 609 |  |  |         $this->context->debug('Unknown how to pass symbol by ref'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 610 |  |  |         return new CompiledExpression(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 611 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 612 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 613 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 614 |  |  |      * @param Node\Expr\Variable $expr | 
            
                                                                                                            
                            
            
                                    
            
            
                | 615 |  |  |      * @return CompiledExpression | 
            
                                                                                                            
                            
            
                                    
            
            
                | 616 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 617 | 5 |  |     protected function passExprVariable(Node\Expr\Variable $expr) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 618 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 619 | 5 |  |         $variable = $this->context->getSymbol($expr->name); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 620 | 5 |  |         if ($variable) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 621 | 5 |  |             $variable->incGets(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 622 | 5 |  |             return new CompiledExpression($variable->getType(), $variable->getValue(), $variable); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 623 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 624 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 625 |  |  |         $this->context->notice( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 626 |  |  |             'undefined-variable', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 627 |  |  |             sprintf('You trying to use undefined variable $%s', $expr->name), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 628 |  |  |             $expr | 
            
                                                                                                            
                            
            
                                    
            
            
                | 629 |  |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 630 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 631 |  |  |         return new CompiledExpression(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 632 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 633 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 634 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 635 |  |  |      * Compile Array_ expression to CompiledExpression | 
            
                                                                                                            
                            
            
                                    
            
            
                | 636 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 637 |  |  |      * @param Node\Expr\Array_ $expr | 
            
                                                                                                            
                            
            
                                    
            
            
                | 638 |  |  |      * @return CompiledExpression | 
            
                                                                                                            
                            
            
                                    
            
            
                | 639 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 640 | 16 |  |     protected function getArray(Node\Expr\Array_ $expr) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 641 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 642 | 16 |  |         if ($expr->items === []) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 643 | 8 |  |             return new CompiledExpression(CompiledExpression::ARR, []); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 644 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 645 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 646 | 8 |  |         $resultArray = []; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 647 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 648 | 8 |  |         foreach ($expr->items as $item) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 649 | 8 |  |             $compiledValueResult = $this->compile($item->value); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 650 | 8 |  |             if ($item->key) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 651 | 1 |  |                 $compiledKeyResult = $this->compile($item->key); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 652 | 1 |  |                 switch ($compiledKeyResult->getType()) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 653 | 1 |  |                     case CompiledExpression::INTEGER: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 654 | 1 |  |                     case CompiledExpression::DOUBLE: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 655 | 1 |  |                     case CompiledExpression::BOOLEAN: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 656 | 1 |  |                     case CompiledExpression::NULL: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 657 | 1 |  |                     case CompiledExpression::STRING: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 658 | 1 |  |                         $resultArray[$compiledKeyResult->getValue()] = $compiledValueResult->getValue(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 659 | 1 |  |                         break; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 660 |  |  |                     default: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 661 |  |  |                         $this->context->debug("Type {$compiledKeyResult->getType()} is not supported for key value"); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 662 |  |  |                         return new CompiledExpression(CompiledExpression::ARR); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 663 |  |  |                         break; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 664 | 1 |  |                 } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 665 | 1 |  |             } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 666 | 7 |  |                 $resultArray[] = $compiledValueResult->getValue(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 667 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 668 | 8 |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 669 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 670 | 8 |  |         return new CompiledExpression(CompiledExpression::ARR, $resultArray); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 671 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 672 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 673 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 674 |  |  |      * Convert const fetch expr to CompiledExpression | 
            
                                                                                                            
                            
            
                                    
            
            
                | 675 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 676 |  |  |      * @param Node\Expr\ConstFetch $expr | 
            
                                                                                                            
                            
            
                                    
            
            
                | 677 |  |  |      * @return CompiledExpression | 
            
                                                                                                            
                            
            
                                    
            
            
                | 678 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 679 | 5 |  |     protected function constFetch(Node\Expr\ConstFetch $expr) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 680 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 681 | 5 |  |         if ($expr->name instanceof Node\Name) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 682 | 5 |  |             if ($expr->name->parts[0] === 'true') { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 683 | 4 |  |                 return new CompiledExpression(CompiledExpression::BOOLEAN, true); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 684 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 685 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 686 | 2 |  |             if ($expr->name->parts[0] === 'false') { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 687 |  |  |                 return new CompiledExpression(CompiledExpression::BOOLEAN, false); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 688 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 689 | 2 |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 690 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 691 |  |  |         /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 692 |  |  |          * @todo Implement check | 
            
                                                                                                            
                            
            
                                    
            
            
                | 693 |  |  |          */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 694 | 2 |  |         return $this->compile($expr->name); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 695 |  |  |     } | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 696 |  |  | } | 
            
                                                        
            
                                    
            
            
                | 697 |  |  |  | 
            
                        
The class complexity is the sum of the complexity of all methods. A very high value is usually an indication that your class does not follow the single reponsibility principle and does more than one job.
Some resources for further reading:
You can also find more detailed suggestions for refactoring in the “Code” section of your repository.