private function convertLinksToText(Element $topNode): self {
        if (!empty($topNode)) {
            $links = $topNode->find('a');

            foreach ($links as $item) {
                $images = $item->find('img');

                if ($images->count() == 0) {
                    $item->replaceWith(new Text(Helper::textNormalise($item->text())));
                }
            }
        }

        return $this;
    }
private function convertLinksToText(Element $topNode): self {
        if (!empty($topNode)) {
            $links = $topNode->find('a');

            foreach ($links as $item) {
                $images = $item->find('img');

                if ($images->count() == 0) {
                    $item->replaceWith(new Text(Helper::textNormalise($item->text())));
                }
            }
        }

        return $this;
    }
private function convertLinksToText ( Element $ topNode ) : self { if ( ! empty ( $ topNode ) ) { $ links = $ topNode -> find ( 'a' ) ; foreach ( $ links as $ item ) { $ images = $ item -> find ( 'img' ) ; if ( $ images -> count ( ) == 0 ) { $ item -> replaceWith ( new Text ( Helper :: textNormalise ( $ item -> text ( ) ) ) ) ; } } } return $ this ; }
cleans up and converts any nodes that should be considered text into text

@param Element $topNode

@return self
cleans up and converts any nodes that should be considered text into text