src/Nodes/NodeTrait.php
public function initializeNode($weightClasses)
    {
        if (!$this->isInitialized()) {
            $contentScore = 0;

            switch ($this->nodeName) {
                case 'div':
                    $contentScore += 5;
                    break;

                case 'pre':
                case 'td':
                case 'blockquote':
                    $contentScore += 3;
                    break;

                case 'address':
                case 'ol':
                case 'ul':
                case 'dl':
                case 'dd':
                case 'dt':
                case 'li':
                case 'form':
                    $contentScore -= 3;
                    break;

                case 'h1':
                case 'h2':
                case 'h3':
                case 'h4':
                case 'h5':
                case 'h6':
                case 'th':
                    $contentScore -= 5;
                    break;
            }

            $this->contentScore = $contentScore + ($weightClasses ? $this->getClassWeight() : 0);

            $this->initialized = true;
        }

        return $this;
    }
public function initializeNode($weightClasses)
    {
        if (!$this->isInitialized()) {
            $contentScore = 0;

            switch ($this->nodeName) {
                case 'div':
                    $contentScore += 5;
                    break;

                case 'pre':
                case 'td':
                case 'blockquote':
                    $contentScore += 3;
                    break;

                case 'address':
                case 'ol':
                case 'ul':
                case 'dl':
                case 'dd':
                case 'dt':
                case 'li':
                case 'form':
                    $contentScore -= 3;
                    break;

                case 'h1':
                case 'h2':
                case 'h3':
                case 'h4':
                case 'h5':
                case 'h6':
                case 'th':
                    $contentScore -= 5;
                    break;
            }

            $this->contentScore = $contentScore + ($weightClasses ? $this->getClassWeight() : 0);

            $this->initialized = true;
        }

        return $this;
    }
public function initializeNode ( $ weightClasses ) { if ( ! $ this -> isInitialized ( ) ) { $ contentScore = 0 ; switch ( $ this -> nodeName ) { case 'div' : $ contentScore += 5 ; break ; case 'pre' : case 'td' : case 'blockquote' : $ contentScore += 3 ; break ; case 'address' : case 'ol' : case 'ul' : case 'dl' : case 'dd' : case 'dt' : case 'li' : case 'form' : $ contentScore -= 3 ; break ; case 'h1' : case 'h2' : case 'h3' : case 'h4' : case 'h5' : case 'h6' : case 'th' : $ contentScore -= 5 ; break ; } $ this -> contentScore = $ contentScore + ( $ weightClasses ? $ this -> getClassWeight ( ) : 0 ) ; $ this -> initialized = true ; } return $ this ; }
Initializer. Calculates the current score of the node and returns a full Readability object.

@ TODO: I don't like the weightClasses param. How can we get the config here?

@param $weightClasses bool Weight classes?

@return static
Initializer . Calculates the current score of the node and returns a full Readability object .