/** * @return string */ public function getDeviceType() { if (!$this->deviceDetection) { return ''; } return $this->deviceDetection->getType(); }
/** * @param GetResponseEvent $event */ public function onKernelRequest(GetResponseEvent $event) { if (HttpKernelInterface::MASTER_REQUEST === $event->getRequestType()) { if ($this->autoDetect) { $this->autoDetect->setUserAgent($event->getRequest()->server->get('HTTP_USER_AGENT')); } $cookieValue = null; if (null !== $this->cookieOptions) { $cookieValue = $event->getRequest()->cookies->get($this->cookieOptions['name']); } if (!$cookieValue && $this->autoDetect instanceof DeviceDetectionInterface) { $cookieValue = $this->autoDetect->getType(); } if ($cookieValue && $cookieValue !== $this->activeTheme->getName() && in_array($cookieValue, $this->activeTheme->getThemes())) { $this->activeTheme->setName($cookieValue); // store into cookie if ($this->cookieOptions) { $this->newTheme = $cookieValue; } } } }