當前位置: 首頁>>代碼示例>>PHP>>正文


PHP AssetInterface::all方法代碼示例

本文整理匯總了PHP中Assetic\Asset\AssetInterface::all方法的典型用法代碼示例。如果您正苦於以下問題:PHP AssetInterface::all方法的具體用法?PHP AssetInterface::all怎麽用?PHP AssetInterface::all使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Assetic\Asset\AssetInterface的用法示例。


在下文中一共展示了AssetInterface::all方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: findAssetsInCollection

 /**
  * Create list all assets
  */
 private function findAssetsInCollection(AssetInterface $asset, $collectionName)
 {
     if ($asset instanceof AssetCollectionInterface) {
         foreach ($asset->all() as $subAsset) {
             $this->findAssetsInCollection($subAsset, $collectionName);
         }
     } else {
         if (!in_array($asset, $this->collectionAssets[$collectionName])) {
             $this->collectionAssets[$collectionName][] = $asset;
         }
     }
 }
開發者ID:mike227,項目名稱:n-assetic,代碼行數:15,代碼來源:AssetList.php

示例2: getHash

 /**
  * Get the sha1 hash of an asset or asset collection
  *
  * @param AssetInterface $asset
  * @param AssetFactory $factory
  * @return string
  */
 protected function getHash(AssetInterface $asset, AssetFactory $factory)
 {
     $hash = hash_init('sha1');
     if ($asset instanceof AssetCollectionInterface) {
         foreach ($asset->all() as $i => $leaf) {
             $this->hashAsset($leaf, $hash);
         }
     } else {
         $this->hashAsset($asset, $hash);
     }
     return substr(hash_final($hash), 0, 7);
 }
開發者ID:course-hero,項目名稱:assetic-filehash-buster,代碼行數:19,代碼來源:FilehashCacheBustingWorker.php

示例3: getCacheKey

 /**
  * @param AssetInterface $asset
  * @return string 
  */
 protected function getCacheKey(AssetInterface $asset)
 {
     $cacheKey = '';
     if ($asset instanceof AssetCollectionInterface) {
         foreach ($asset->all() as $childAsset) {
             $cacheKey .= $childAsset->getSourcePath();
             $cacheKey .= $childAsset->getLastModified();
         }
     } else {
         $cacheKey .= $asset->getSourcePath();
         $cacheKey .= $asset->getLastModified();
     }
     foreach ($asset->getFilters() as $filter) {
         if ($filter instanceof HashableInterface) {
             $cacheKey .= $filter->hash();
         } else {
             $cacheKey .= serialize($filter);
         }
     }
     return md5($cacheKey);
 }
開發者ID:mpoiriert,項目名稱:nucleus,代碼行數:25,代碼來源:Manager.php

示例4: getCompileFileName

 /**
  * Builds a compile filename for an asset with the
  * requested extension.
  *
  * @param  \Assetic\Asset\AssetInterface  $asset
  * @param  string  $extension
  * @return string
  */
 public function getCompileFileName(AssetInterface $asset, $extension)
 {
     $cacheKey = '';
     $assetName = '';
     if ($asset instanceof AssetCollectionInterface) {
         switch ($extension) {
             case 'css':
                 $assetName = 'styles';
                 break;
             case 'js':
             default:
                 $assetName = 'scripts';
                 break;
         }
         foreach ($asset->all() as $actualAsset) {
             $cacheKey .= $this->getCacheKey($actualAsset);
         }
     } else {
         $assetName = $asset->getSlug();
         $cacheKey .= $this->getCacheKey($asset);
     }
     if ($values = $asset->getValues()) {
         asort($values);
         $cacheKey .= serialize($values);
     }
     $lastModified = $asset->getLastModified();
     return $assetName . '.' . md5($cacheKey) . '_' . $lastModified . ".{$extension}";
 }
開發者ID:sohailaammarocs,項目名稱:lfc,代碼行數:36,代碼來源:AssetManager.php


注:本文中的Assetic\Asset\AssetInterface::all方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。