public function setTitle($title)
    {
        // Check if title already exists
        $headTitle = $this->selectElement('title')->item(0);
        if (!is_null($headTitle)) {
            $headTitle_new = $this->create('title', $title);
            $headTitle->parentNode->replaceChild($headTitle_new, $headTitle);
        } else {
            $headTitle = $this->create('title', $title);
            $this->appendToHead($headTitle);
        }

        return $this;
    }
public function setTitle($title)
    {
        // Check if title already exists
        $headTitle = $this->selectElement('title')->item(0);
        if (!is_null($headTitle)) {
            $headTitle_new = $this->create('title', $title);
            $headTitle->parentNode->replaceChild($headTitle_new, $headTitle);
        } else {
            $headTitle = $this->create('title', $title);
            $this->appendToHead($headTitle);
        }

        return $this;
    }
public function setTitle ( $ title ) { // Check if title already exists $ headTitle = $ this -> selectElement ( 'title' ) -> item ( 0 ) ; if ( ! is_null ( $ headTitle ) ) { $ headTitle_new = $ this -> create ( 'title' , $ title ) ; $ headTitle -> parentNode -> replaceChild ( $ headTitle_new , $ headTitle ) ; } else { $ headTitle = $ this -> create ( 'title' , $ title ) ; $ this -> appendToHead ( $ headTitle ) ; } return $ this ; }
Sets the page title.

@param string $title The new page title.

@return $this
@throws Exception
@throws InvalidArgumentException
Sets the page title .