/** * @return bool */ public function isBackendRoute() { if (!$this->request) { return true; } return !$this->helper->isFrontendRequest($this->request); }
/** * @return bool */ protected function isFrontendRoute() { $currentRequest = $this->requestStack->getCurrentRequest(); if (!$currentRequest) { return false; } return $this->helper->isFrontendRequest($currentRequest); }
/** * @param GetResponseEvent $event */ public function onKernelRequest(GetResponseEvent $event) { if (!$this->installed) { return; } if ($event->getRequestType() !== HttpKernelInterface::MASTER_REQUEST) { return; } if ($this->helper->isFrontendRequest($event->getRequest())) { $this->themeRegistry->setActiveTheme(self::FRONTEND_THEME); } }
/** * @param string $path * @param bool $isFrontend * @dataProvider isFrontendRequestDataProvider */ public function testIsFrontendRequest($path, $isFrontend) { $helper = new FrontendHelper(self::BACKEND_PREFIX); $this->assertSame($isFrontend, $helper->isFrontendRequest(Request::create($path))); }