private function replaceTagsWithText(Element $topNode) { if (!empty($topNode)) { $items = $topNode->find('b, strong, i'); foreach ($items as $item) { $item->replaceWith(new Text($this->getTagCleanedText($item))); } } }