Exemplo n.º 1
0
 /**
  * Add a file asset to the queue.
  *
  * @param FileAssetInterface $asset
  *
  * @throws \InvalidArgumentException
  */
 public function add(FileAssetInterface $asset)
 {
     $url = $this->packages->getUrl($asset->getPath(), $asset->getPackageName());
     $asset->setUrl($url);
     if ($asset->getType() === 'javascript') {
         $this->javascript[$url] = $asset;
     } elseif ($asset->getType() === 'stylesheet') {
         $this->stylesheet[$url] = $asset;
     } else {
         throw new \InvalidArgumentException(sprintf('Requested asset type %s is not valid.', $asset->getType()));
     }
 }
Exemplo n.º 2
0
Arquivo: Queue.php Projeto: d-m-/bolt
 /**
  * Add a file asset to the queue.
  *
  * @param FileAssetInterface $asset
  *
  * @throws \InvalidArgumentException
  */
 public function add(FileAssetInterface $asset)
 {
     $fileHasher = $this->fileHasher;
     $cacheHash = $fileHasher($asset->getFileName());
     $asset->setCacheHash($cacheHash);
     if ($asset->getType() === 'javascript') {
         $this->javascript[$cacheHash] = $asset;
     } elseif ($asset->getType() === 'stylesheet') {
         $this->stylesheet[$cacheHash] = $asset;
     } else {
         throw new \InvalidArgumentException(sprintf('Requested asset type %s is not valid.', $asset->getType()));
     }
 }