QuackCompiler\Parser\Grammar::_foreachStmt PHP Method

_foreachStmt() public method

public _foreachStmt ( )
    public function _foreachStmt()
    {
        $key = null;
        $by_reference = false;
        $this->parser->match(Tag::T_FOREACH);
        if ($this->parser->is(Tag::T_IDENT)) {
            $alias = $this->identifier();
            if ($this->parser->consumeIf('->')) {
                $key = $alias;
                $by_reference = $this->parser->consumeIf('*');
                $alias = $this->identifier();
            }
        } else {
            $by_reference = $this->parser->consumeIf('*');
            $alias = $this->identifier();
        }
        $this->parser->match(Tag::T_IN);
        $iterable = $this->_expr();
        $body = iterator_to_array($this->_innerStmtList());
        $this->parser->match(Tag::T_END);
        return new ForeachStmt($by_reference, $key, $alias, $iterable, $body);
    }