Conditions | 3 |
Paths | 1 |
Total Lines | 56 |
Code Lines | 28 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
1 | <?php |
||
79 | public function registerAdapters() |
||
80 | { |
||
81 | // Local file system adapter |
||
82 | $this->registerAdapter('local', function(string $sRootDir, $xOptions) { |
||
83 | return empty($xOptions) ? new LocalFilesystemAdapter($sRootDir) : |
||
84 | new LocalFilesystemAdapter($sRootDir, $xOptions); |
||
85 | }); |
||
86 | |||
87 | // In memory file system adapter |
||
88 | $this->registerAdapter('memory', function() { |
||
89 | return new \League\Flysystem\InMemory\InMemoryFilesystemAdapter(); |
||
|
|||
90 | }); |
||
91 | |||
92 | // AWS S3 file system adapter |
||
93 | $this->registerAdapter('aws-s3', function(string $sRootDir, array $aOptions) { |
||
94 | /** @var \Aws\S3\S3ClientInterface $client */ |
||
95 | $client = new \Aws\S3\S3Client($aOptions['client'] ?? []); |
||
96 | return new \League\Flysystem\AwsS3V3\AwsS3V3Adapter($client, $aOptions['bucket'] ?? '', $sRootDir); |
||
97 | }); |
||
98 | |||
99 | // Async AWS S3 file system adapter |
||
100 | $this->registerAdapter('async-aws-s3', function(string $sRootDir, array $aOptions) { |
||
101 | $client = isset($aOptions['client']) ? new \AsyncAws\S3\S3Client($aOptions['client']) : new \AsyncAws\S3\S3Client(); |
||
102 | return new \League\Flysystem\AsyncAwsS3\AsyncAwsS3Adapter($client, $aOptions['bucket'] ?? '', $sRootDir); |
||
103 | }); |
||
104 | |||
105 | // Google Cloud file system adapter |
||
106 | $this->registerAdapter('google-cloud', function(string $sRootDir, array $aOptions) { |
||
107 | $storageClient = new \Google\Cloud\Storage\StorageClient($aOptions['client'] ?? []); |
||
108 | $bucket = $storageClient->bucket($aOptions['bucket'] ?? ''); |
||
109 | return new \League\Flysystem\AzureBlobStorage\GoogleCloudStorageAdapter($bucket, $sRootDir); |
||
110 | }); |
||
111 | |||
112 | // Microsoft Azure file system adapter |
||
113 | $this->registerAdapter('azure-blob', function(string $sRootDir, array $aOptions) { |
||
114 | $client = \MicrosoftAzure\Storage\Blob\BlobRestProxy::createBlobService($aOptions['dsn']); |
||
115 | return new \League\Flysystem\AzureBlobStorage\AzureBlobStorageAdapter($client, $aOptions['container'], $sRootDir); |
||
116 | }); |
||
117 | |||
118 | // FTP file system adapter |
||
119 | $this->registerAdapter('ftp', function(string $sRootDir, array $aOptions) { |
||
120 | $aOptions['root'] = $sRootDir; |
||
121 | $xOptions = \League\Flysystem\Ftp\FtpConnectionOptions::fromArray($aOptions); |
||
122 | return new \League\Flysystem\Ftp\FtpAdapter($xOptions); |
||
123 | }); |
||
124 | |||
125 | // SFTP V2 file system adapter |
||
126 | $this->registerAdapter('sftp-v2', function(string $sRootDir, array $aOptions) { |
||
127 | $provider = new \League\Flysystem\PhpseclibV2\SftpConnectionProvider(...$aOptions); |
||
128 | return new \League\Flysystem\PhpseclibV2\SftpAdapter($provider, $sRootDir); |
||
129 | }); |
||
130 | |||
131 | // SFTP V3 file system adapter |
||
132 | $this->registerAdapter('sftp-v3', function(string $sRootDir, array $aOptions) { |
||
133 | $provider = new \League\Flysystem\PhpseclibV3\SftpConnectionProvider(...$aOptions); |
||
134 | return new \League\Flysystem\PhpseclibV3\SftpAdapter($provider, $sRootDir); |
||
135 | }); |
||
177 |
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