Goose\Modules\Formatters\OutputFormatter::getSiblingContent PHP Метод

getSiblingContent() приватный Метод

Adds any siblings that may have a decent score to this node
private getSiblingContent ( DOMWrap\Element $currentSibling, integer $baselineScoreForSiblingParagraphs ) : DOMWrap\Element[]
$currentSibling DOMWrap\Element
$baselineScoreForSiblingParagraphs integer
Результат DOMWrap\Element[]
    private function getSiblingContent(Element $currentSibling, $baselineScoreForSiblingParagraphs)
    {
        $text = trim($currentSibling->text());
        if ($currentSibling->is('p, strong') && !empty($text)) {
            return [$currentSibling];
        }
        $results = [];
        $nodes = $currentSibling->find('p, strong');
        foreach ($nodes as $node) {
            $text = trim($node->text());
            if (!empty($text)) {
                $wordStats = $this->config()->getStopWords()->getStopwordCount($text);
                if ($baselineScoreForSiblingParagraphs * self::$SIBLING_BASE_LINE_SCORE < $wordStats->getStopWordCount()) {
                    $results[] = $node->document()->createElement('p', $text);
                }
            }
        }
        return $results;
    }