public function calculateSeo(SeoEvent $event) { $seo = $event->getSeo(); /* * Trim title */ $title = SeoTools::plain($seo->getTitle(), $this->maxTitleLength); $seo->setTitle($title); /* * Trim meta description */ if ($seo->hasMeta('name', 'description')) { $description = SeoTools::plain($seo->getMetas('name', 'description'), $this->maxDescriptionLength); $seo->addMetaName('description', $description); } }