当前位置: 首页>>代码示例>>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;未经允许,请勿转载。