PHPCfg\Block::create PHP Method

create() public method

public create ( )
    public function create()
    {
        return new static();
    }

Usage Example

コード例 #1
0
ファイル: Parser.php プロジェクト: ircmaxell/php-cfg
 protected function parseExpr_Ternary(Expr\Ternary $expr)
 {
     $attrs = $this->mapAttributes($expr);
     $cond = $this->readVariable($this->parseExprNode($expr->cond));
     $ifBlock = $this->block->create();
     $elseBlock = $this->block->create();
     $endBlock = $this->block->create();
     $this->block->children[] = new JumpIf($cond, $ifBlock, $elseBlock, $attrs);
     $this->processAssertions($cond, $ifBlock, $elseBlock);
     $ifBlock->addParent($this->block);
     $elseBlock->addParent($this->block);
     $this->block = $ifBlock;
     $ifVar = new Temporary();
     if ($expr->if) {
         $this->block->children[] = new Op\Expr\Assign($ifVar, $this->readVariable($this->parseExprNode($expr->if)), $attrs);
     } else {
         $this->block->children[] = new Op\Expr\Assign($ifVar, $cond, $attrs);
     }
     $this->block->children[] = new Jump($endBlock, $attrs);
     $endBlock->addParent($this->block);
     $this->block = $elseBlock;
     $elseVar = new Temporary();
     $this->block->children[] = new Op\Expr\Assign($elseVar, $this->readVariable($this->parseExprNode($expr->else)), $attrs);
     $this->block->children[] = new Jump($endBlock, $attrs);
     $endBlock->addParent($this->block);
     $this->block = $endBlock;
     $result = new Temporary();
     $phi = new Op\Phi($result, ['block' => $this->block]);
     $phi->addOperand($ifVar);
     $phi->addOperand($elseVar);
     $this->block->phi[] = $phi;
     return $result;
 }
All Usage Examples Of PHPCfg\Block::create