private function removeNodesWithNegativeScores(Element $topNode): self {
        if (!empty($topNode)) {
            $gravityItems = $topNode->find('*[gravityScore]');

            foreach ($gravityItems as $item) {
                $score = (int)$item->attr('gravityScore');

                if ($score < 1) {
                    $item->remove();
                }
            }
        }

        return $this;
    }
private function removeNodesWithNegativeScores(Element $topNode): self {
        if (!empty($topNode)) {
            $gravityItems = $topNode->find('*[gravityScore]');

            foreach ($gravityItems as $item) {
                $score = (int)$item->attr('gravityScore');

                if ($score < 1) {
                    $item->remove();
                }
            }
        }

        return $this;
    }
private function removeNodesWithNegativeScores ( Element $ topNode ) : self { if ( ! empty ( $ topNode ) ) { $ gravityItems = $ topNode -> find ( '*[gravityScore]' ) ; foreach ( $ gravityItems as $ item ) { $ score = ( int ) $ item -> attr ( 'gravityScore' ) ; if ( $ score < 1 ) { $ item -> remove ( ) ; } } } return $ this ; }
if there are elements inside our top node that have a negative gravity score, let's
give em the boot

@param Element $topNode

@return self
if there are elements inside our top node that have a negative gravity score let s give em the boot