Total Complexity | 7 |
Total Lines | 49 |
Duplicated Lines | 0 % |
Changes | 2 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
10 | class Flysystem implements FilesystemInterface |
||
11 | { |
||
12 | /** |
||
13 | * @var Filesystem |
||
14 | */ |
||
15 | protected $filesystem; |
||
16 | |||
17 | public function __construct(Filesystem $filesystem) |
||
18 | { |
||
19 | $this->filesystem = $filesystem; |
||
20 | } |
||
21 | |||
22 | /** |
||
23 | * {@inheritdoc} |
||
24 | */ |
||
25 | public function upload(string $key, UploadedFile $file, bool $overwrite = false) |
||
26 | { |
||
27 | try { |
||
28 | $this->uploadToFlysystem($key, $file); |
||
29 | } catch (RuntimeException $exception) { |
||
30 | if (!$overwrite) { |
||
31 | throw new \RuntimeException(sprintf('The file with key "%s" is exists.', $key)); |
||
32 | } |
||
33 | $this->filesystem->delete($key); |
||
34 | $this->uploadToFlysystem($key, $file); |
||
35 | } |
||
36 | @unlink($file->getPathname()); //remove old |
||
37 | return true; |
||
38 | } |
||
39 | |||
40 | /** |
||
41 | * {@inheritdoc} |
||
42 | */ |
||
43 | public function delete(File $file): bool |
||
48 | } |
||
49 | |||
50 | /** |
||
51 | * @param string $key |
||
52 | * @param UploadedFile $file |
||
53 | * @throws RuntimeException |
||
54 | */ |
||
55 | protected function uploadToFlysystem(string $key, UploadedFile $file): void |
||
59 | } |
||
60 | } |
||
62 |
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