ServiceProvider::boot()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 15
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 10
c 1
b 0
f 0
nc 2
nop 0
dl 0
loc 15
ccs 0
cts 14
cp 0
crap 6
rs 9.4285
1
<?php
2
3
namespace Freyo\Flysystem\QcloudCOSv3;
4
5
use Freyo\Flysystem\QcloudCOSv3\Plugins\GetUrl;
6
use Freyo\Flysystem\QcloudCOSv3\Plugins\PutRemoteFile;
7
use Freyo\Flysystem\QcloudCOSv3\Plugins\PutRemoteFileAs;
8
use Illuminate\Support\ServiceProvider as LaravelServiceProvider;
9
use Laravel\Lumen\Application as LumenApplication;
10
use League\Flysystem\Filesystem;
11
12
/**
13
 * Class ServiceProvider.
14
 */
15
class ServiceProvider extends LaravelServiceProvider
16
{
17
    /**
18
     * Bootstrap any application services.
19
     *
20
     * @return void
21
     */
22
    public function boot()
23
    {
24
        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...
25
            $this->app->configure('filesystems');
26
        }
27
28
        $this->app->make('filesystem')
29
                  ->extend('cosv3', function ($app, $config) {
30
                      $flysystem = new Filesystem(new Adapter($config));
31
                      $flysystem->addPlugin(new PutRemoteFile());
32
                      $flysystem->addPlugin(new PutRemoteFileAs());
33
                      $flysystem->addPlugin(new GetUrl());
34
                      return $flysystem;
35
                  });
36
    }
37
38
    /**
39
     * Register any application services.
40
     *
41
     * @return void
42
     */
43
    public function register()
44
    {
45
        $this->mergeConfigFrom(
46
            __DIR__.'/filesystems.php', 'filesystems'
47
        );
48
    }
49
}
50