Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix CommonNode references to $children instead of $nodes #2

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/Dissect/Node/CommonNode.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class CommonNode implements Node
* Constructor.
*
* @param array $attributes The attributes of this node.
* @param array $children The children of this node.
* @param array $nodes The children of this node.
*/
public function __construct(array $attributes = array(), array $nodes = array())
{
Expand Down Expand Up @@ -54,7 +54,7 @@ public function hasNode($key)
*/
public function getNode($key)
{
if (!isset($this->children[$key])) {
if (!isset($this->nodes[$key])) {
throw new RuntimeException(sprintf('No child node "%s" exists.', $key));
}

Expand All @@ -66,15 +66,15 @@ public function getNode($key)
*/
public function setNode($key, Node $child)
{
$this->children[$key] = $child;
$this->nodes[$key] = $child;
}

/**
* {@inheritDoc}
*/
public function removeNode($key)
{
unset($this->children[$key]);
unset($this->nodes[$key]);
}

/**
Expand Down Expand Up @@ -123,11 +123,11 @@ public function removeAttribute($key)

public function count()
{
return count($this->children);
return count($this->nodes);
}

public function getIterator()
{
return new ArrayIterator($this->children);
return new ArrayIterator($this->nodes);
}
}