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;
 }
 /**
  *
  * @param zool\file\File $resourceFile
  * @return File
  */
 private function copyToResources($resourceFile, $resourcePath)
 {
     $baseName = $resourceFile->getFileNameWithoutExtension();
     $extension = $resourceFile->getExtension();
     $fileHash = HashGenerator::instance()->hash($resourceFile->getMTime(), 7);
     $hashedBaseName = $baseName . '_' . $fileHash;
     $hashedResourcePath = str_replace($baseName, $hashedBaseName, $resourcePath);
     $targetPath = RESOURCES_PATH . '/' . $hashedResourcePath;
     $targetFile = new File($targetPath);
     if (!$targetFile->exists()) {
         /*
          * Delete previous versions of file
          */
         $targetDir = $targetFile->getDirectory();
         if ($targetDir->exists()) {
             $baseName = $targetFile->getFileNameWithoutExtension();
             $prevFilesPattern = '/^' . $baseName . '_(.){7}\\.' . $extension . '$/i';
             $prevoiusFiles = $targetDir->getFiles(false, $prevFilesPattern);
             foreach ($prevoiusFiles as $prevFilePath) {
                 (new File($prevFilePath))->delete();
             }
         }
         $targetFile->content($resourceFile->content());
     }
     return [$targetFile, RESOURCES_DIRNAME . '/' . $hashedResourcePath];
 }