public function parse(AbstractStream $stream)
    {
        if (!($this->dataSet instanceof DataSet)) {
            $this->dataSet = new DataSet;
        }

        $this->rewind();
        do {
            $field = $this->current();
            $field->setDataSet($this->getDataSet());
            if ($field instanceof Conditional) {
                $field = $field->resolveField();
            }
            if ($field instanceof self) {
                $this->dataSet->push($this->key());
                $field->parse($stream);
                $this->dataSet->pop();
            } else {
                $this->dataSet->setValue($this->key(), $field->parse($stream));
            }
            $this->next();
        } while ($this->valid());

        if (isset($this->assert)) {
            $this->validate($this->dataSet->getValueByCurrentPath());
        }

        return $this->dataSet->getData();
    }
public function parse(AbstractStream $stream)
    {
        if (!($this->dataSet instanceof DataSet)) {
            $this->dataSet = new DataSet;
        }

        $this->rewind();
        do {
            $field = $this->current();
            $field->setDataSet($this->getDataSet());
            if ($field instanceof Conditional) {
                $field = $field->resolveField();
            }
            if ($field instanceof self) {
                $this->dataSet->push($this->key());
                $field->parse($stream);
                $this->dataSet->pop();
            } else {
                $this->dataSet->setValue($this->key(), $field->parse($stream));
            }
            $this->next();
        } while ($this->valid());

        if (isset($this->assert)) {
            $this->validate($this->dataSet->getValueByCurrentPath());
        }

        return $this->dataSet->getData();
    }
public function parse ( AbstractStream $ stream ) { if ( ! ( $ this -> dataSet instanceof DataSet ) ) { $ this -> dataSet = new DataSet ; } $ this -> rewind ( ) ; do { $ field = $ this -> current ( ) ; $ field -> setDataSet ( $ this -> getDataSet ( ) ) ; if ( $ field instanceof Conditional ) { $ field = $ field -> resolveField ( ) ; } if ( $ field instanceof self ) { $ this -> dataSet -> push ( $ this -> key ( ) ) ; $ field -> parse ( $ stream ) ; $ this -> dataSet -> pop ( ) ; } else { $ this -> dataSet -> setValue ( $ this -> key ( ) , $ field -> parse ( $ stream ) ) ; } $ this -> next ( ) ; } while ( $ this -> valid ( ) ) ; if ( isset ( $ this -> assert ) ) { $ this -> validate ( $ this -> dataSet -> getValueByCurrentPath ( ) ) ; } return $ this -> dataSet -> getData ( ) ; }
Recursively call parse method of all children and store values in associated DataSet.

@api
@param AbstractStream $stream Stream from which children read.
@return array Array of parsed values.
Recursively call parse method of all children and store values in associated DataSet .