bytic /
filesystem
| 1 | <?php |
||||||
| 2 | |||||||
| 3 | namespace Nip\Filesystem\FilesystemManager; |
||||||
| 4 | |||||||
| 5 | use Aws\S3\S3Client; |
||||||
| 6 | use League\Flysystem\AwsS3v3\AwsS3Adapter as S3Adapter; |
||||||
|
0 ignored issues
–
show
|
|||||||
| 7 | use League\Flysystem\FilesystemInterface; |
||||||
|
0 ignored issues
–
show
The type
League\Flysystem\FilesystemInterface 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 Nip\Filesystem\FileDisk; |
||||||
| 9 | |||||||
| 10 | /** |
||||||
| 11 | * Trait HasCloudDriverTrait |
||||||
| 12 | * @package Nip\Filesystem\FilesystemManager |
||||||
| 13 | */ |
||||||
| 14 | trait HasCloudDriverTrait |
||||||
| 15 | { |
||||||
| 16 | /** |
||||||
| 17 | * Create an instance of the Amazon S3 driver. |
||||||
| 18 | * |
||||||
| 19 | * @param array $config |
||||||
| 20 | * @return FilesystemInterface|FileDisk |
||||||
| 21 | */ |
||||||
| 22 | public function createS3Driver(array $config) |
||||||
| 23 | { |
||||||
| 24 | $s3Config = $this->formatS3Config($config); |
||||||
| 25 | $root = $s3Config['root'] ?? null; |
||||||
| 26 | $options = $config['options'] ?? []; |
||||||
| 27 | |||||||
| 28 | return $this->adapt($this->createDisk( |
||||||
|
0 ignored issues
–
show
It seems like
adapt() must be provided by classes using this trait. How about adding it as abstract method to this trait?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
It seems like
createDisk() must be provided by classes using this trait. How about adding it as abstract method to this trait?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
| 29 | new S3Adapter(new S3Client($s3Config), $s3Config['bucket'], $root, $options), |
||||||
| 30 | $config |
||||||
| 31 | )); |
||||||
| 32 | } |
||||||
| 33 | |||||||
| 34 | /** |
||||||
| 35 | * Format the given S3 configuration with the default options. |
||||||
| 36 | * |
||||||
| 37 | * @param array $config |
||||||
| 38 | * @return array |
||||||
| 39 | */ |
||||||
| 40 | protected function formatS3Config(array $config) |
||||||
| 41 | { |
||||||
| 42 | $config += ['version' => 'latest']; |
||||||
| 43 | if ($config['key'] && $config['secret']) { |
||||||
| 44 | $config['credentials'] = [ |
||||||
| 45 | 'key' => $config['key'], |
||||||
| 46 | 'secret' => $config['secret'], |
||||||
| 47 | ]; |
||||||
| 48 | } |
||||||
| 49 | if (empty($config['endpoint'])) { |
||||||
| 50 | unset($config['endpoint']); |
||||||
| 51 | } |
||||||
| 52 | |||||||
| 53 | return $config; |
||||||
| 54 | } |
||||||
| 55 | } |
||||||
| 56 |
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