Passed
Pull Request — master (#42)
by
unknown
15:10
created

GoogleFactory   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 8
c 1
b 0
f 0
dl 0
loc 17
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getConfigKey() 0 3 1
A getFilesystemAdapter() 0 10 1
1
<?php
2
3
namespace AnyCloud\Service\File\Store;
4
5
use AnyCloud\File\Store;
6
use Google\Cloud\Storage\StorageClient;
7
use Interop\Container\ContainerInterface;
8
use Laminas\ServiceManager\Factory\FactoryInterface;
0 ignored issues
show
Bug introduced by
The type Laminas\ServiceManager\Factory\FactoryInterface 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. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
9
use League\Flysystem\Filesystem;
10
use League\Flysystem\GoogleCloudStorage\GoogleCloudStorageAdapter;
11
12
class GoogleFactory extends AbstractFlysystemFactory
13
{
14
    protected function getConfigKey(): string
15
    {
16
        return 'google';
17
    }
18
19
    protected function getFilesystemAdapter(array $config): FilesystemAdapter
0 ignored issues
show
Bug introduced by
The type AnyCloud\Service\File\Store\FilesystemAdapter 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. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
20
    {
21
        $client = new StorageClient([
22
            'projectId'   => $config['project_id'],
23
            'keyFilePath' => sprintf('%s/modules/AnyCloud%s', OMEKA_PATH, $config['credentials_path']),
0 ignored issues
show
Bug introduced by
The constant AnyCloud\Service\File\Store\OMEKA_PATH was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
24
        ]);
25
        $bucket = $client->bucket($config['bucket_name']);
26
        $adapter = new GoogleCloudStorageAdapter($bucket);
27
28
        return $adapter;
29
    }
30
}
31