ServiceProvider   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 3
eloc 13
dl 0
loc 35
c 0
b 0
f 0
ccs 0
cts 19
cp 0
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A boot() 0 16 2
A register() 0 4 1
1
<?php
2
3
namespace Freyo\Flysystem\QcloudCOSv4;
4
5
use Freyo\Flysystem\QcloudCOSv4\Plugins\GetUrl;
6
use Freyo\Flysystem\QcloudCOSv4\Plugins\PutRemoteFile;
7
use Freyo\Flysystem\QcloudCOSv4\Plugins\PutRemoteFileAs;
8
use Illuminate\Support\ServiceProvider as LaravelServiceProvider;
0 ignored issues
show
Bug introduced by
The type Illuminate\Support\ServiceProvider 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 Laravel\Lumen\Application as LumenApplication;
0 ignored issues
show
Bug introduced by
The type Laravel\Lumen\Application 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...
10
use League\Flysystem\Filesystem;
11
use QCloud\Cos\Api;
12
13
/**
14
 * Class ServiceProvider.
15
 */
16
class ServiceProvider extends LaravelServiceProvider
17
{
18
    /**
19
     * Bootstrap any application services.
20
     *
21
     * @return void
22
     */
23
    public function boot()
24
    {
25
        if ($this->app instanceof LumenApplication) {
26
            $this->app->configure('filesystems');
27
        }
28
29
        $this->app->make('filesystem')
30
                  ->extend('cosv4', function ($app, $config) {
31
                      $cosApi = new Api($config);
32
                      $flysystem = new Filesystem(new Adapter($cosApi, $config));
33
34
                      $flysystem->addPlugin(new PutRemoteFile());
35
                      $flysystem->addPlugin(new PutRemoteFileAs());
36
                      $flysystem->addPlugin(new GetUrl());
37
38
                      return $flysystem;
39
                  });
40
    }
41
42
    /**
43
     * Register any application services.
44
     *
45
     * @return void
46
     */
47
    public function register()
48
    {
49
        $this->mergeConfigFrom(
50
            __DIR__.'/filesystems.php', 'filesystems'
51
        );
52
    }
53
}
54