Artesaos\SEOTools\SEOTools::getTitle PHP Method

getTitle() public method

Get current title from metatags.
public getTitle ( boolean $session = false ) : string
$session boolean
return string
    public function getTitle($session = false)
    {
        if ($session) {
            return $this->metatags()->getTitleSession();
        }
        return $this->metatags()->getTitle();
    }

Usage Example

Example #1
0
 public function test_set_title()
 {
     $this->seoTools->setTitle('Kamehamehaaaaaaa');
     $expected = "<title>Kamehamehaaaaaaa - It's Over 9000!</title>";
     $expected .= '<meta name="description" content="For those who helped create the Genki Dama">';
     $expected .= '<meta property="og:title" content="Kamehamehaaaaaaa" />';
     $expected .= '<meta property="og:description" content="For those who helped create the Genki Dama" />';
     $expected .= '<meta name="twitter:title" content="Kamehamehaaaaaaa" />';
     $this->assertEquals('Kamehamehaaaaaaa - It\'s Over 9000!', $this->seoTools->getTitle());
     $this->setRightAssertion($expected);
 }