private function getTmpFilePath($alias, $resourceFile)
 {
     list($module, $path) = PathResolver::instance()->moduleNameAndPath($alias);
     $modulePath = Modules::instance()->pathOf($module);
     $dirAndFile = str_replace($modulePath, '', $resourceFile->getPath());
     $dir = str_replace($resourceFile->getFileName(), '', $dirAndFile);
     $baseName = $resourceFile->getFileNameWithoutExtension();
     $extension = $resourceFile->getExtension();
     $fileHash = HashGenerator::instance()->hash($resourceFile->getMTime(), 7);
     $hashedFileName = $baseName . '_' . $fileHash . '.' . $extension;
     return self::$TMP_DIR . '/' . $module . '/' . $dir . '/' . $hashedFileName;
 }
 public function getResourceUrl($alias)
 {
     list($moduleName, $path) = PathResolver::instance()->moduleNameAndPath($alias);
     $modulePath = Modules::instance()->pathOf($moduleName);
     $resourceFile = new File($modulePath . '/' . self::RESOURCE_DIRNAME . '/' . $path);
     if (!$resourceFile->exists()) {
         $this->throwResourceNotFoundException($resourcePath);
     }
     $resourceLocation = $this->copyToResources($resourceFile, $resourcePath)[1];
     return UrlManager::instance()->geBaseUrl() . '/' . $resourceLocation;
 }
 /**
  * @param string $alias resource alias
  */
 public function moduleNameAndPath($alias)
 {
     $isModuleResource = Strings::contains($alias, self::MODULE_SEPARATOR) && Strings::contains($alias, self::PATH_SEPARATOR) && strpos($alias, '.') < strpos($alias, '/');
     $module = APP_MODULE_NAME;
     $path = $alias;
     if ($isModuleResource) {
         list($module, $path) = explode(self::MODULE_SEPARATOR, $alias, 2);
         $path = trim($path, '/');
     }
     if (!Modules::instance()->exists($module)) {
         throw new ModuleNotFoundException($module);
     }
     return [$module, $path];
 }