public function __invoke($filename)
{
// nothing to append
if (empty($this->config['view_helper']['append_timestamp'])) {
return $filename;
}
// search the cache config for the specific file requested (if none, use the default one)
if (isset($this->config['caching'][$filename])) {
$cacheConfig = $this->config['caching'][$filename];
} elseif (isset($this->config['caching']['default'])) {
$cacheConfig = $this->config['caching']['default'];
}
// query string params
$queryString = isset($this->config['view_helper']['query_string']) ? $this->config['view_helper']['query_string'] : '_';
// no cache dir is defined
if (!isset($cacheConfig['options']['dir'])) {
// append current timestamp to the filepath and use a custom query string
return $this->appendTimestamp($filename, $queryString);
}
// get the filePath from the cache (if available)
$filePath = $this->getFilePathFromCache($filename, $queryString);
if ($filePath !== null) {
return $filePath;
}
return $this->elaborateFilePath($filename, $queryString);
}