/**
  * @param GetResponseEvent $event
  */
 public function onKernelRequest(GetResponseEvent $event)
 {
     if (HttpKernelInterface::MASTER_REQUEST !== $event->getRequestType()) {
         // don't do anything if it's not the master request
         return;
     }
     $this->deviceDetection->setUserAgent($event->getRequest()->headers->get('User-Agent'));
 }
 /**
  * @param string         $resourceName
  * @param ThemeInterface $theme
  *
  * @return array
  */
 protected function getApplicationPaths($resourceName, ThemeInterface $theme)
 {
     $paths = [sprintf('%s/%s', $theme->getPath(), $resourceName)];
     if ($this->deviceDetection->getType() !== null) {
         $paths[] = sprintf('%s/%s/%s', $theme->getPath(), $this->deviceDetection->getType(), $resourceName);
         krsort($paths);
     }
     return $paths;
 }
 /**
  * @param string         $resourcePath
  * @param ThemeInterface $theme
  */
 protected function getBundlePaths($resourcePath, ThemeInterface $theme)
 {
     $bundleName = $this->getBundleNameFromResourcePath($resourcePath);
     $resourceName = $this->getResourceNameFromResourcePath($resourcePath);
     $bundles = $this->kernel->getBundle($bundleName, false);
     $paths = [];
     if (is_array($bundles)) {
         foreach ($bundles as $bundle) {
             if ($this->deviceDetection->getType() !== null) {
                 $paths[] = sprintf('%s/%s/%s/%s', $theme->getPath(), $this->deviceDetection->getType(), $bundle->getName(), $resourceName);
             }
             $paths[] = sprintf('%s/%s/%s', $theme->getPath(), $bundle->getName(), $resourceName);
         }
     }
     return $paths;
 }