File
- drupal/core/vendor/kriswallsmith/assetic/src/Assetic/Factory/Worker/CacheBustingWorker.php, line 57
Class
- CacheBustingWorker
- Adds cache busting code
Namespace
Assetic\Factory\Worker
Code
protected function getHash(AssetInterface $asset) {
$hash = hash_init('sha1');
hash_update($hash, $this->am
->getLastModified($asset));
if ($asset instanceof AssetCollectionInterface) {
foreach ($asset as $i => $leaf) {
$sourcePath = $leaf
->getSourcePath();
hash_update($hash, $sourcePath ?: $i);
}
}
return substr(hash_final($hash), 0, 7);
}