Artesaos\SEOTools\SEOMeta::removeMeta PHP Method

removeMeta() public method

Remove a metatag.
public removeMeta ( string $key ) : Artesaos\SEOTools\Contracts\MetaTags
$key string
return Artesaos\SEOTools\Contracts\MetaTags
    public function removeMeta($key)
    {
        array_forget($this->metatags, $key);
        return $this;
    }

Usage Example

Beispiel #1
0
 public function test_remove_metatag()
 {
     $fullHeader = "<title>It's Over 9000!</title>";
     $fullHeader .= "<meta name=\"description\" content=\"For those who helped create the Genki Dama\">";
     $this->seoMeta->addMeta('no-content');
     $this->seoMeta->addMeta(['custom-meta' => 'value']);
     $this->seoMeta->addMeta('custom-meta', 'value', 'test');
     $fullHeaderWithTags = $fullHeader . "<meta test=\"custom-meta\" content=\"value\">";
     $this->setRightAssertion($fullHeaderWithTags);
     $this->seoMeta->removeMeta('custom-meta');
     $this->seoMeta->removeMeta('no-content');
     $this->setRightAssertion($fullHeader);
     $this->assertEquals(count([]), count($this->seoMeta->getMetatags()));
 }