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


PHP AssetInterface::getFilters方法代碼示例

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


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

示例1: getFilters

 /**
  * {@inheritdoc}
  */
 public function getFilters()
 {
     if ($this->innerAsset) {
         return $this->innerAsset->getFilters();
     }
     return $this->filters->all();
 }
開發者ID:puli,項目名稱:assetic-extension,代碼行數:10,代碼來源:LazyAsset.php

示例2: 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

示例3: getLastModified

 public function getLastModified(AssetInterface $asset)
 {
     $mtime = $asset->getLastModified();
     if (!($filters = $asset->getFilters())) {
         return $mtime;
     }
     // prepare load path
     $sourceRoot = $asset->getSourceRoot();
     $sourcePath = $asset->getSourcePath();
     $loadPath = $sourceRoot && $sourcePath ? dirname($sourceRoot . '/' . $sourcePath) : null;
     $prevFilters = array();
     foreach ($filters as $filter) {
         $prevFilters[] = $filter;
         if (!$filter instanceof DependencyExtractorInterface) {
             continue;
         }
         // extract children from asset after running all preceeding filters
         $clone = clone $asset;
         $clone->clearFilters();
         foreach (array_slice($prevFilters, 0, -1) as $prevFilter) {
             $clone->ensureFilter($prevFilter);
         }
         $clone->load();
         foreach ($filter->getChildren($this->factory, $clone->getContent(), $loadPath) as $child) {
             $mtime = max($mtime, $this->getLastModified($child));
         }
     }
     return $mtime;
 }
開發者ID:anatalsceo,項目名稱:en-classe,代碼行數:29,代碼來源:LazyAssetManager.php

示例4: getCacheKey

 /**
  * Returns the cache key for the given filters of an asset.
  *
  * @param  \Assetic\Asset\AssetInterface  $asset
  * @return string  $cacheKey
  * @throws \InvalidArgumentException
  */
 public function getCacheKey(AssetInterface $asset)
 {
     if ($asset instanceof AssetCollectionInterface) {
         throw new InvalidArgumentException('getCacheKey() should only be called on individual assets.');
     }
     $cacheKey = $asset->getSourceRoot();
     $cacheKey .= $asset->getSourcePath();
     $cacheKey .= $asset->getTargetPath();
     foreach ($asset->getFilters() as $filter) {
         if ($filter instanceof HashableInterface) {
             $cacheKey .= $filter->hash();
         } else {
             $cacheKey .= serialize($filter);
         }
     }
     return $cacheKey;
 }
開發者ID:sohailaammarocs,項目名稱:lfc,代碼行數:24,代碼來源:AssetManager.php

示例5: getFilters

 /**
  * Returns an array of filters currently applied.
  *
  * @return array
  */
 public function getFilters()
 {
     return $this->asset->getFilters();
 }
開發者ID:sunnyct,項目名稱:silexcmf-assetic,代碼行數:9,代碼來源:AssetCache.php

示例6: cleanFilters

 /**
  * Clean filters, remove css-rewrite filter and inherit collection filters.
  *
  * @param AssetInterface $asset            The asset.
  * @param array          $inheritedFilters The inherited filters.
  *
  * @return void
  */
 private function cleanFilters(AssetInterface $asset, array $inheritedFilters)
 {
     // remove css-rewrite filter
     $filters = $asset->getFilters();
     $asset->clearFilters();
     foreach ($filters as $filter) {
         if (!$filter instanceof CssRewriteFilter) {
             $asset->ensureFilter($filter);
         }
     }
     // inherit filters
     foreach ($inheritedFilters as $filter) {
         if (!$filter instanceof CssRewriteFilter) {
             $asset->ensureFilter($filter);
         }
     }
 }
開發者ID:bit3,項目名稱:contao-theme-plus,代碼行數:25,代碼來源:AssetOrganizerSubscriber.php


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