| 1 |  |  | <?php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 3 |  |  | namespace PHPSA\Compiler\Expression\Operators\Logical; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 4 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 5 |  |  | use PHPSA\CompiledExpression; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 6 |  |  | use PHPSA\Context; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 7 |  |  | use PHPSA\Compiler\Expression; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 8 |  |  | use PHPSA\Compiler\Expression\AbstractExpressionCompiler; | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 9 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 10 |  |  | class LogicalAnd extends AbstractExpressionCompiler | 
            
                                                                        
                            
            
                                    
            
            
                | 11 |  |  | { | 
            
                                                                        
                            
            
                                    
            
            
                | 12 |  |  |     protected $name = 'PhpParser\Node\Expr\BinaryOp\LogicalAnd'; | 
            
                                                                        
                            
            
                                    
            
            
                | 13 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 14 |  |  |     /** | 
            
                                                                        
                            
            
                                    
            
            
                | 15 |  |  |      * {expr} and {expr} | 
            
                                                                        
                            
            
                                    
            
            
                | 16 |  |  |      * | 
            
                                                                        
                            
            
                                    
            
            
                | 17 |  |  |      * @param \PhpParser\Node\Expr\BinaryOp\LogicalAnd $expr | 
            
                                                                        
                            
            
                                    
            
            
                | 18 |  |  |      * @param Context $context | 
            
                                                                        
                            
            
                                    
            
            
                | 19 |  |  |      * @return CompiledExpression | 
            
                                                                        
                            
            
                                    
            
            
                | 20 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 21 | 15 |  |     protected function compile($expr, Context $context) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 22 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 23 | 15 |  |         $left = $context->getExpressionCompiler()->compile($expr->left); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 24 | 15 |  |         $right = $context->getExpressionCompiler()->compile($expr->right); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 25 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 26 | 15 |  |         switch ($left->getType()) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 27 | 15 |  |             case CompiledExpression::INTEGER: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 28 | 15 |  |             case CompiledExpression::DOUBLE: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 29 | 15 |  |             case CompiledExpression::STRING: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 30 | 15 |  |             case CompiledExpression::BOOLEAN: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 31 | 15 |  |             case CompiledExpression::NULL: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 32 | 15 |  |             case CompiledExpression::ARR: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 33 | 15 |  |             case CompiledExpression::NUMBER: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 34 | 15 |  |             case CompiledExpression::OBJECT: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 35 | 15 |  |                 switch ($right->getType()) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 36 | 15 |  |                     case CompiledExpression::INTEGER: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 37 | 15 |  |                     case CompiledExpression::DOUBLE: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 38 | 15 |  |                     case CompiledExpression::STRING: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 39 | 15 |  |                     case CompiledExpression::BOOLEAN: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 40 | 15 |  |                     case CompiledExpression::NULL: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 41 | 15 |  |                     case CompiledExpression::ARR: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 42 | 15 |  |                     case CompiledExpression::NUMBER: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 43 | 15 |  |                     case CompiledExpression::OBJECT: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 44 | 14 |  |                         return CompiledExpression::fromZvalValue($left->getValue() and $right->getValue()); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 45 | 1 |  |                 } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 46 | 1 |  |                 break; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 47 | 1 |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 48 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 49 | 1 |  |         return new CompiledExpression(CompiledExpression::BOOLEAN); | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 50 |  |  |     } | 
            
                                                        
            
                                    
            
            
                | 51 |  |  | } | 
            
                                                        
            
                                    
            
            
                | 52 |  |  |  |