Completed
Push — master ( c5bf72...b82ad7 )
by frey
03:46
created

ServiceProvider   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 6

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 6
dl 0
loc 38
ccs 0
cts 21
cp 0
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A boot() 0 18 2
A register() 0 6 1
1
<?php
2
3
namespace Freyo\Flysystem\QcloudCOSv5;
4
5
use Freyo\Flysystem\QcloudCOSv5\Plugins\GetUrl;
6
use Freyo\Flysystem\QcloudCOSv5\Plugins\PutRemoteFile;
7
use Freyo\Flysystem\QcloudCOSv5\Plugins\PutRemoteFileAs;
8
use Illuminate\Support\ServiceProvider as LaravelServiceProvider;
9
use Laravel\Lumen\Application as LumenApplication;
10
use League\Flysystem\Filesystem;
11
use Qcloud\Cos\Client;
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) {
0 ignored issues
show
Bug introduced by
The class Laravel\Lumen\Application does not exist. Did you forget a USE statement, or did you not list all dependencies?

This error could be the result of:

1. Missing dependencies

PHP Analyzer uses your composer.json file (if available) to determine the dependencies of your project and to determine all the available classes and functions. It expects the composer.json to be in the root folder of your repository.

Are you sure this class is defined by one of your dependencies, or did you maybe not list a dependency in either the require or require-dev section?

2. Missing use statement

PHP does not complain about undefined classes in ìnstanceof checks. For example, the following PHP code will work perfectly fine:

if ($x instanceof DoesNotExist) {
    // Do something.
}

If you have not tested against this specific condition, such errors might go unnoticed.

Loading history...
26
            $this->app->configure('filesystems');
27
        }
28
29
        $this->app->make('filesystem')
30
                  ->extend('cosv5', function ($app, $config) {
31
                      $client = new Client($config);
32
                      $flysystem = new Filesystem(new Adapter($client, $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