Passed
Push — master ( 8cb180...a21f4c )
by frey
02:22
created

ServiceProvider   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 5

Test Coverage

Coverage 0%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 5
c 2
b 0
f 0
lcom 0
cbo 5
dl 0
loc 43
ccs 0
cts 27
cp 0
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
B boot() 0 23 4
A register() 0 6 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\Foundation\Application as LaravelApplication;
9
use Illuminate\Support\Facades\Storage;
10
use Illuminate\Support\ServiceProvider as LaravelServiceProvider;
11
use Laravel\Lumen\Application as LumenApplication;
12
use League\Flysystem\Filesystem;
13
14
/**
15
 * Class ServiceProvider.
16
 */
17
class ServiceProvider extends LaravelServiceProvider
18
{
19
    /**
20
     * Bootstrap any application services.
21
     *
22
     * @return void
23
     */
24
    public function boot()
25
    {
26
        $source = realpath(__DIR__ . '/filesystems.php');
27
28
        if ($this->app instanceof LaravelApplication) {
0 ignored issues
show
Bug introduced by
The class Illuminate\Foundation\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...
29
            if ($this->app->runningInConsole()) {
30
                $this->publishes([
31
                    $source => config_path('filesystems.php'),
32
                ]);
33
            }
34
        } elseif ($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...
35
            $this->app->configure('filesystems');
36
        }
37
38
        $this->app->make('filesystem')
39
                  ->extend('cosv4', function ($app, $config) {
40
                      return new Filesystem(new Adapter($config));
41
                  })
42
                  ->disk('cosv4')
43
                  ->addPlugin(new PutRemoteFile())
44
                  ->addPlugin(new PutRemoteFileAs())
45
                  ->addPlugin(new GetUrl());
46
    }
47
48
    /**
49
     * Register any application services.
50
     *
51
     * @return void
52
     */
53
    public function register()
54
    {
55
        $this->mergeConfigFrom(
56
            __DIR__.'/filesystems.php', 'filesystems'
57
        );
58
    }
59
}
60