Skip to content

Commit

Permalink
Merge pull request #67 from havvg/feature/amazons3-resolver
Browse files Browse the repository at this point in the history
move getFilePath to AbstractFilesystemResolver
  • Loading branch information
lsmith77 committed May 4, 2012
2 parents ddeebf2 + 4645098 commit fc4ef48
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 19 deletions.
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 @@ -64,25 +64,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

0 comments on commit fc4ef48

Please sign in to comment.