Skip to content

Commit

Permalink
Update Statistics:
Browse files Browse the repository at this point in the history
- split parse()
  • Loading branch information
webeweb committed Sep 30, 2019
1 parent 9244a21 commit 6c85f68
Showing 1 changed file with 37 additions and 10 deletions.
47 changes: 37 additions & 10 deletions src/Statistic/Statistics.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,20 +100,47 @@ public function parse(DOMNode $domNode, DOMNode $parent = null) {
$statistic->setAttrName($domNode->nodeName);
}

if (null !== $domNode->attributes) {
$this->parseAttributes($domNode);
$this->parseChildNodes($domNode);

/** @var DOMNode $current */
foreach ($domNode->attributes as $current) {
$this->parse($current, $domNode);
}
return $this;
}

/**
* Parse the attributes.
*
* @param DOMNode $domNode The DOM node.
* @return Statistics Returns this statistics.
*/
protected function parseAttributes(DOMNode $domNode) {

if (null === $domNode->attributes) {
return $this;
}

/** @var DOMNode $current */
foreach ($domNode->attributes as $current) {
$this->parse($current, $domNode);
}

if (null !== $domNode->childNodes) {
return $this;
}

/**
* Parse the attributes.
*
* @param DOMNode $domNode The DOM node.
* @return Statistics Returns this statistics.
*/
protected function parseChildNodes(DOMNode $domNode) {

if (null === $domNode->childNodes) {
return $this;
}

/** @var DOMNode $current */
foreach ($domNode->childNodes as $current) {
$this->parse($current);
}
/** @var DOMNode $current */
foreach ($domNode->childNodes as $current) {
$this->parse($current);
}

return $this;
Expand Down

0 comments on commit 6c85f68

Please sign in to comment.