You are here

public function NodeElement::getDescendants in Extensible BBCode 8.3

Same name and namespace in other branches
  1. 4.0.x src/Parser/Tree/NodeElement.php \Drupal\xbbcode\Parser\Tree\NodeElement::getDescendants()

Retrieve the descendants of the node.

Return value

\Drupal\xbbcode\Parser\Tree\ElementInterface[]|\iterable Every descendant of the node.

Overrides NodeElementInterface::getDescendants

File

src/Parser/Tree/NodeElement.php, line 66

Class

NodeElement
A node element contains other elements.

Namespace

Drupal\xbbcode\Parser\Tree

Code

public function getDescendants() : Iterator {
  foreach ($this->children as $child) {
    (yield $child);
    if ($child instanceof NodeElementInterface) {
      yield from $child
        ->getDescendants();
    }
  }
}