Returns a copy of the current asset with filters and a target URL applied.
Boolean $raw Returns the unmodified asset if true:
public function current($raw = false) {
$asset = current($this->assets);
if ($raw) {
return $asset;
}
// clone once
if (!isset($this->clones[$asset])) {
$clone = $this->clones[$asset] = clone $asset;
// generate a target path based on asset name
$name = sprintf('%s_%d', pathinfo($asset
->getSourcePath(), PATHINFO_FILENAME) ?: 'part', $this
->key() + 1);
$clone
->setTargetPath(str_replace('*', $name, $this->output));
}
else {
$clone = $this->clones[$asset];
}
// cascade filters
foreach ($this->filters as $filter) {
$clone
->ensureFilter($filter);
}
return $clone;
}