matthiasmullie /
scrapbook
| 1 | <?php |
||
| 2 | |||
| 3 | namespace MatthiasMullie\Scrapbook\Adapters\Collections; |
||
| 4 | |||
| 5 | use League\Flysystem\FileNotFoundException; |
||
|
0 ignored issues
–
show
|
|||
| 6 | use League\Flysystem\Filesystem; |
||
|
0 ignored issues
–
show
The type
League\Flysystem\Filesystem was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||
| 7 | use League\Flysystem\UnableToDeleteFile; |
||
|
0 ignored issues
–
show
The type
League\Flysystem\UnableToDeleteFile was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||
| 8 | use MatthiasMullie\Scrapbook\Adapters\Flysystem as Adapter; |
||
| 9 | |||
| 10 | /** |
||
| 11 | * Flysystem 1.x and 2.x adapter for a subset of data, in a subfolder. |
||
| 12 | * |
||
| 13 | * @author Matthias Mullie <[email protected]> |
||
| 14 | * @copyright Copyright (c) 2014, Matthias Mullie. All rights reserved |
||
| 15 | * @license LICENSE MIT |
||
| 16 | */ |
||
| 17 | class Flysystem extends Adapter |
||
| 18 | { |
||
| 19 | /** |
||
| 20 | * @var string |
||
| 21 | */ |
||
| 22 | protected $collection; |
||
| 23 | |||
| 24 | /** |
||
| 25 | * @param string $collection |
||
| 26 | */ |
||
| 27 | public function __construct(Filesystem $filesystem, $collection) |
||
| 28 | { |
||
| 29 | parent::__construct($filesystem); |
||
| 30 | $this->collection = $collection; |
||
| 31 | } |
||
| 32 | |||
| 33 | /** |
||
| 34 | * {@inheritdoc} |
||
| 35 | */ |
||
| 36 | public function flush() |
||
| 37 | { |
||
| 38 | $files = $this->filesystem->listContents($this->collection); |
||
| 39 | foreach ($files as $file) { |
||
| 40 | try { |
||
| 41 | if ('dir' === $file['type']) { |
||
| 42 | if (1 === $this->version) { |
||
| 43 | $this->filesystem->deleteDir($file['path']); |
||
| 44 | } else { |
||
| 45 | $this->filesystem->deleteDirectory($file['path']); |
||
| 46 | } |
||
| 47 | } else { |
||
| 48 | $this->filesystem->delete($file['path']); |
||
| 49 | } |
||
| 50 | } catch (FileNotFoundException $e) { |
||
| 51 | // v1.x |
||
| 52 | // don't care if we failed to unlink something, might have |
||
| 53 | // been deleted by another process in the meantime... |
||
| 54 | } catch (UnableToDeleteFile $e) { |
||
| 55 | // v2.x |
||
| 56 | // don't care if we failed to unlink something, might have |
||
| 57 | // been deleted by another process in the meantime... |
||
| 58 | } |
||
| 59 | } |
||
| 60 | |||
| 61 | return true; |
||
| 62 | } |
||
| 63 | |||
| 64 | /** |
||
| 65 | * @param string $key |
||
| 66 | * |
||
| 67 | * @return string |
||
| 68 | */ |
||
| 69 | protected function path($key) |
||
| 70 | { |
||
| 71 | return $this->collection.'/'.parent::path($key); |
||
| 72 | } |
||
| 73 | } |
||
| 74 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths