本文整理汇总了PHP中Assetic\Asset\AssetCollection::getTargetPath方法的典型用法代码示例。如果您正苦于以下问题:PHP AssetCollection::getTargetPath方法的具体用法?PHP AssetCollection::getTargetPath怎么用?PHP AssetCollection::getTargetPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Assetic\Asset\AssetCollection
的用法示例。
在下文中一共展示了AssetCollection::getTargetPath方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createGroup
/**
* Create a new AssetCollection instance for the given group.
*
* @param string $name
* @param bool $overwrite force writing
* @return \Assetic\Asset\AssetCollection
*/
public function createGroup($name, $overwrite = false)
{
if (isset($this->groups[$name])) {
return $this->groups[$name];
}
$assets = $this->createAssetArray($name);
$filters = $this->createFilterArray($name);
$coll = new AssetCollection($assets, $filters);
if ($output = $this->getConfig($name, 'output')) {
$coll->setTargetPath($output);
}
// check output cache
$write_output = true;
if (!$overwrite) {
if (file_exists($output = public_path($coll->getTargetPath()))) {
$output_mtime = filemtime($output);
$asset_mtime = $coll->getLastModified();
if ($asset_mtime && $output_mtime >= $asset_mtime) {
$write_output = false;
}
}
}
// store assets
if ($overwrite || $write_output) {
$writer = new AssetWriter(public_path());
$writer->writeAsset($coll);
}
return $this->groups[$name] = $coll;
}
示例2: __construct
public function __construct(AssetCollection $coll)
{
$this->assets = $coll->all();
$this->filters = $coll->getFilters();
$this->output = $coll->getTargetPath();
if (false === ($pos = strpos($this->output, '.'))) {
$this->output .= '_*';
} else {
$this->output = substr($this->output, 0, $pos) . '_*' . substr($this->output, $pos);
}
}