protected function parseIf($node, Block $endBlock)
{
$attrs = $this->mapAttributes($node);
$cond = $this->readVariable($this->parseExprNode($node->cond));
$ifBlock = new Block($this->block);
$elseBlock = new Block($this->block);
$this->block->children[] = new JumpIf($cond, $ifBlock, $elseBlock, $attrs);
$this->processAssertions($cond, $ifBlock, $elseBlock);
$this->block = $this->parseNodes($node->stmts, $ifBlock);
$this->block->children[] = new Jump($endBlock, $attrs);
$endBlock->addParent($this->block);
$this->block = $elseBlock;
if ($node instanceof Node\Stmt\If_) {
foreach ($node->elseifs as $elseIf) {
$this->parseIf($elseIf, $endBlock);
}
if ($node->else) {
$this->block = $this->parseNodes($node->else->stmts, $this->block);
}
$this->block->children[] = new Jump($endBlock, $attrs);
$endBlock->addParent($this->block);
}
}