コード例 #1
0
 private function version($path)
 {
     if (null === $this->versioningScheme) {
         return $path;
     }
     $version = $this->versioningScheme->getVersion($path);
     if (!$version) {
         return $path;
     }
     return sprintf('%s?%s', $path, $version);
 }
コード例 #2
0
 /**
  * Warms up the cache.
  *
  * @param string $cacheDir The cache directory
  */
 public function warmUp($cacheDir)
 {
     if (false === is_dir($this->assetsDir)) {
         return;
     }
     $finder = new Finder();
     $finder->files()->in($this->assetsDir);
     $result = [];
     /** @var SplFileInfo $file */
     foreach ($finder as $file) {
         $cannonicalName = $file->getRelativePathname();
         $result[$cannonicalName] = $this->versioningScheme->getVersion('/' . $cannonicalName);
     }
     $cacheDir = sprintf($cacheDir . '/' . $this->cacheName);
     $this->writeCacheFile($cacheDir, sprintf('<?php return %s;', var_export($result, true)));
 }