PHPSA\Context::setCurrentBranch PHP Méthode

setCurrentBranch() public méthode

public setCurrentBranch ( integer | string $currentBranch )
$currentBranch integer | string
    public function setCurrentBranch($currentBranch)
    {
        $this->currentBranch = $currentBranch;
    }

Usage Example

Exemple #1
0
 /**
  * @param \PhpParser\Node\Stmt\If_ $ifStatement
  * @param Context $context
  * @return 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);
 }