/** * Default constructor for directory base * @param string $path */ function __construct($path) { if (!Str::endsWith($path, '/')) { $path .= '/'; } if (!Str::startsWith($path, '/')) { $path = '/' . $path; } $cwd = getcwd(); if (strpos($path, $cwd) === false) { $path = $cwd . $path; } $path = Str::flipDS($path); $this->path = $path; }
/** * Retrieves cache destination of specific source asset * @param \qio\Asset $asset * @return \qio\File\Asset */ public function getTarget(qio\Asset $asset) { $path = qtil\StringUtil::flipDS($asset->getPath()); $nfo = pathinfo($path); $basename = $nfo['basename']; $targetPath = $this->getDestination()->getPath() . DIRECTORY_SEPARATOR . $basename; return new \qio\File\Asset($this, $targetPath); }