PHPSA\Compiler\Statement\IfSt::compile PHP Method

compile() public method

public compile ( PhpParser\Node\Stmt\If_ $ifStatement, Context $context ) : CompiledExpression
$ifStatement PhpParser\Node\Stmt\If_
$context PHPSA\Context
return PHPSA\CompiledExpression
    public function compile($ifStatement, Context $context)
    {
        $context->setCurrentBranch(Variable::BRANCH_CONDITIONAL_TRUE);
        $context->getExpressionCompiler()->compile($ifStatement->cond);
        foreach ($ifStatement->stmts as $stmt) {
            \PHPSA\nodeVisitorFactory($stmt, $context);
        }
        $context->setCurrentBranch(Variable::BRANCH_CONDITIONAL_EXTERNAL);
        foreach ($ifStatement->elseifs as $elseIfStatement) {
            \PHPSA\nodeVisitorFactory($elseIfStatement, $context);
        }
        $context->setCurrentBranch(Variable::BRANCH_CONDITIONAL_FALSE);
        if ($ifStatement->else) {
            \PHPSA\nodeVisitorFactory($ifStatement->else, $context);
        }
        $context->setCurrentBranch(Variable::BRANCH_ROOT);
    }