Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

move getFilePath to AbstractFilesystemResolver #67

Merged
merged 1 commit into from
May 4, 2012
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions Imagine/Cache/Resolver/AbstractFilesystemResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,33 @@ public function store(Response $response, $targetPath, $filter)

return $response;
}

/**
* Removes a stored image resource.
*
* @param string $targetPath The target path provided by the resolve method.
* @param string $filter The name of the imagine filter in effect.
*
* @return bool Whether the file has been removed successfully.
*/
public function remove($targetPath, $filter)
{
$filename = $this->getFilePath($targetPath, $filter);
$this->filesystem->remove($filename);

return file_exists($filename);
}

/**
* Return the local filepath.
*
* @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
*
* @param string $path The resource path to convert.
* @param string $filter The name of the imagine filter.
* @param string $basePath An optional base path to remove from the path.
*
* @return string
*/
abstract protected function getFilePath($path, $filter, $basePath = '');
}
19 changes: 0 additions & 19 deletions Imagine/Cache/Resolver/WebPathResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,25 +58,6 @@ public function getBrowserPath($targetPath, $filter, $absolute = false)
/**
* {@inheritDoc}
*/
public function remove($targetPath, $filter)
{
$filename = $this->getFilePath($targetPath, $filter);
$this->filesystem->remove($filename);

return file_exists($filename);
}

/**
* Return the local filepath.
*
* @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
*
* @param string $path The resource path to convert.
* @param string $filter The name of the imagine filter.
* @param string $basePath An optional base path to remove from the path.
*
* @return string
*/
protected function getFilePath($path, $filter, $basePath = '')
{
$browserPath = $this->decodeBrowserPath($this->getBrowserPath($path, $filter));
Expand Down