private function getTitle(): string {
        $openGraph = $this->article()->getOpenGraph();

        // Rely on OpenGraph in case we have the data
        if (isset($openGraph['title'])) {
            return $this->cleanTitle($openGraph['title']);
        }

        $nodes = $this->getNodesByLowercasePropertyValue($this->article()->getDoc(), 'meta', 'name', 'headline');
        if ($nodes->count()) {
            return $this->cleanTitle($nodes->first()->attr('content'));
        }

        $nodes = $this->article()->getDoc()->find('html > head > title');
        if ($nodes->count()) {
            return $this->cleanTitle(Helper::textNormalise($nodes->first()->text()));
        }

        return '';
    }
private function getTitle(): string {
        $openGraph = $this->article()->getOpenGraph();

        // Rely on OpenGraph in case we have the data
        if (isset($openGraph['title'])) {
            return $this->cleanTitle($openGraph['title']);
        }

        $nodes = $this->getNodesByLowercasePropertyValue($this->article()->getDoc(), 'meta', 'name', 'headline');
        if ($nodes->count()) {
            return $this->cleanTitle($nodes->first()->attr('content'));
        }

        $nodes = $this->article()->getDoc()->find('html > head > title');
        if ($nodes->count()) {
            return $this->cleanTitle(Helper::textNormalise($nodes->first()->text()));
        }

        return '';
    }
private function getTitle ( ) : string { $ openGraph = $ this -> article ( ) -> getOpenGraph ( ) ; // Rely on OpenGraph in case we have the data if ( isset ( $ openGraph [ 'title' ] ) ) { return $ this -> cleanTitle ( $ openGraph [ 'title' ] ) ; } $ nodes = $ this -> getNodesByLowercasePropertyValue ( $ this -> article ( ) -> getDoc ( ) , 'meta' , 'name' , 'headline' ) ; if ( $ nodes -> count ( ) ) { return $ this -> cleanTitle ( $ nodes -> first ( ) -> attr ( 'content' ) ) ; } $ nodes = $ this -> article ( ) -> getDoc ( ) -> find ( 'html > head > title' ) ; if ( $ nodes -> count ( ) ) { return $ this -> cleanTitle ( Helper :: textNormalise ( $ nodes -> first ( ) -> text ( ) ) ) ; } return '' ; }
Get article title

Ported from python-goose https://github.com/grangier/python-goose/ by Xavier Grangier

@return string
Get article title