setClasses($normalizedClasses); if ($document instanceof DocumentNode) { $this->setNodesClasses($document->getNodes(), $classes); } return $document; } public function appliesToNonBlockContent(): bool { return true; } /** * @param Node[] $nodes * @param string[] $classes */ private function setNodesClasses(array $nodes, array $classes): void { foreach ($nodes as $node) { $node->setClasses($classes); if (! ($node instanceof DocumentNode)) { continue; } $this->setNodesClasses($node->getNodes(), $classes); } } }