function Traverser::traverseChildren
Traverses node children. It returns a boolean indicating if the traversing must continue or not
Parameters
Syntax\Node\Node $node Node:
Return value
bool
2 calls to Traverser::traverseChildren()
- Traverser::execFunctions in vendor/
mck89/ peast/ lib/ Peast/ Traverser.php - Executes all functions on the given node and, if required, starts traversing its children. The returned value is an array where the first value is the node or null if it has been removed and the second value is a boolean indicating if the traverser…
- Traverser::traverse in vendor/
mck89/ peast/ lib/ Peast/ Traverser.php - Starts the traversing
File
-
vendor/
mck89/ peast/ lib/ Peast/ Traverser.php, line 180
Class
- Traverser
- Nodes traverser class
Namespace
PeastCode
protected function traverseChildren(Syntax\Node\Node $node) {
$continue = true;
foreach (Syntax\Utils::getNodeProperties($node, true) as $prop) {
$getter = $prop["getter"];
$setter = $prop["setter"];
$child = $node->{$getter}();
if (!$child) {
continue;
}
elseif (is_array($child)) {
$newChildren = array();
foreach ($child as $c) {
if (!$c || !$continue) {
$newChildren[] = $c;
}
else {
list($c, $continue) = $this->execFunctions($c, $node);
if ($c) {
$newChildren[] = $c;
}
}
}
$node->{$setter}($newChildren);
}
else {
list($child, $continue) = $this->execFunctions($child, $node);
$node->{$setter}($child);
}
if (!$continue) {
break;
}
}
return $continue;
}