public function findChildrenOfType($targetType, array &$results = array()) { foreach ($this->nodes as $node) { if ($node instanceof $targetType) { $results[] = $node; } $node->findChildrenOfType($targetType, $results); } foreach ($this->getMethods() as $method) { $method->findChildrenOfType($targetType, $results); } return $results; }