39 if (!$search = pathinfo(
$path, PATHINFO_EXTENSION)) {
44 $replace = $this->separator.$this->getHash($asset, $factory).
'.'.$search;
45 if (preg_match(
'/'.preg_quote($replace,
'/').
'$/',
$path)) {
51 preg_replace(
'/\.'.preg_quote($search,
'/').
'$/', $replace,
$path)
57 $hash = hash_init(
'sha1');
62 foreach ($asset as $i => $leaf) {
63 $sourcePath = $leaf->getSourcePath();
64 hash_update($hash, $sourcePath ?: $i);
68 return substr(hash_final($hash), 0, 7);
__construct($separator='-')
setTargetPath($targetPath)
Sets the URL for the current asset.
process(AssetInterface $asset, AssetFactory $factory)
Processes an asset.
Assets are passed through factory workers before leaving the factory.
An asset has a mutable URL and content and can be loaded and dumped.
The asset factory creates asset objects.
getTargetPath()
Returns the URL for the current asset.
getLastModified(AssetInterface $asset)
getHash(AssetInterface $asset, AssetFactory $factory)