Pheal\Core\RowSet::__construct PHP Method

__construct() public method

initialize the rowset
public __construct ( SimpleXMLElement $xml, string $name = null, string $rowname = 'row' )
$xml SimpleXMLElement
$name string optional
$rowname string optional
    public function __construct($xml, $name = null, $rowname = 'row')
    {
        $this->_name = (string) ($name !== null) ? $name : $xml->attributes()->name;
        foreach ($xml->{$rowname} as $rowxml) {
            $row = array();
            foreach ($rowxml->attributes() as $attkey => $attval) {
                $row[$attkey] = (string) $attval;
            }
            foreach ($rowxml->children() as $child) {
                // nested tags in rowset/row
                $element = Element::parseElement($child);
                $row[(string) $element->_name] = $element;
            }
            $rowObject = new RowSetRow($row);
            $rowObject->setStringValue((string) $rowxml);
            $this->append($rowObject);
        }
    }