You are here

public function NodeElement::getDescendants in Extensible BBCode 4.0.x

Same name and namespace in other branches
  1. 8.3 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 64

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();
    }
  }
}