* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace HtmlSanitizer\Node; /** * Used by nodes which can have children. * * @author Titouan Galopin */ trait HasChildrenTrait { /** * @var NodeInterface[] */ private $children = []; public function addChild(NodeInterface $child) { $this->children[] = $child; } protected function renderChildren(): string { $rendered = ''; foreach ($this->children as $child) { $rendered .= $child->render(); } return $rendered; } }