public function isCurrentUrl($url) { $pattern = '/\\/$/'; $shortenedUrl = preg_replace($pattern, '/index', $this->getUrl($url)); $shortenedHere = preg_replace($pattern, '/index', $this->request->here); return $shortenedUrl === $shortenedHere; }