PHPCfg\Parser::parseStmt_Foreach PHP Метод

parseStmt_Foreach() защищенный Метод

protected parseStmt_Foreach ( PhpParser\Node\Stmt\Foreach_ $node )
$node PhpParser\Node\Stmt\Foreach_
    protected function parseStmt_Foreach(Stmt\Foreach_ $node)
    {
        $attrs = $this->mapAttributes($node);
        $iterable = $this->readVariable($this->parseExprNode($node->expr));
        $this->block->children[] = new Op\Iterator\Reset($iterable, $attrs);
        $loopInit = new Block();
        $loopBody = new Block();
        $loopEnd = new Block();
        $this->block->children[] = new Jump($loopInit, $attrs);
        $loopInit->addParent($this->block);
        $loopInit->children[] = $validOp = new Op\Iterator\Valid($iterable, $attrs);
        $loopInit->children[] = new JumpIf($validOp->result, $loopBody, $loopEnd, $attrs);
        $this->processAssertions($validOp->result, $loopBody, $loopEnd);
        $loopBody->addParent($loopInit);
        $loopEnd->addParent($loopInit);
        $this->block = $loopBody;
        if ($node->keyVar) {
            $this->block->children[] = $keyOp = new Op\Iterator\Key($iterable, $attrs);
            $this->block->children[] = new Op\Expr\Assign($this->writeVariable($this->parseExprNode($node->keyVar)), $keyOp->result, $attrs);
        }
        $this->block->children[] = $valueOp = new Op\Iterator\Value($iterable, $node->byRef, $attrs);
        if ($node->valueVar instanceof Expr\List_) {
            $this->parseListAssignment($node->valueVar, $valueOp->result);
        } elseif ($node->byRef) {
            $this->block->children[] = new Op\Expr\AssignRef($this->writeVariable($this->parseExprNode($node->valueVar)), $valueOp->result, $attrs);
        } else {
            $this->block->children[] = new Op\Expr\Assign($this->writeVariable($this->parseExprNode($node->valueVar)), $valueOp->result, $attrs);
        }
        $this->block = $this->parseNodes($node->stmts, $this->block);
        $this->block->children[] = new Jump($loopInit, $attrs);
        $loopInit->addParent($this->block);
        $this->block = $loopEnd;
    }
Parser