lib/boab/cms-bundle/src/Filesystem/PublicStorageFilesystem.php line 15

Open in your IDE?
  1. <?php 
  2. namespace Boab\CmsBundle\Filesystem;
  3. use Boab\CmsBundle\Contract\FileUploaderInterface;
  4. use League\Flysystem\FilesystemException;
  5. use League\Flysystem\FilesystemOperator;
  6. use Liip\ImagineBundle\Imagine\Cache\CacheManager;
  7. use Psr\Log\LoggerInterface;
  8. class PublicStorageFilesystem extends BaseFilesystem implements FileUploaderInterface
  9. {
  10.     protected $cachManager;
  11.     public function __construct(FilesystemOperator $filesystemStorageCacheManager $cacheManagerLoggerInterface $logger)
  12.     {
  13.         parent::__construct($filesystemStorage$logger);
  14.         $this->cacheManager $cacheManager;
  15.     }
  16.     public function resolveFilePath(string $pathstring $extension):void
  17.     {
  18.         if(!in_array($extension$this->allowedImageExtensions)){
  19.             return;
  20.         }
  21.         $this->cacheManager->resolve($path'thumbnail_small');
  22.         $this->cacheManager->resolve($path'thumbnail_medium');        
  23.     } 
  24.     
  25.     public function delete(?string $file): void
  26.     {
  27.         parent::delete($file);
  28.         
  29.         $this->cacheManager->remove($file);
  30.     }    
  31. }