UpyunServiceProvider   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 3
dl 0
loc 33
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A boot() 0 15 1
A register() 0 4 1
1
<?php
2
3
namespace JellyBool\Flysystem\Upyun;
4
5
use League\Flysystem\Filesystem;
6
use Illuminate\Support\Facades\Storage;
7
use Illuminate\Support\ServiceProvider;
8
use JellyBool\Flysystem\Upyun\Plugins\ImagePreviewUrl;
9
10
class UpyunServiceProvider extends ServiceProvider
11
{
12
    /**
13
     * Bootstrap the application services.
14
     *
15
     * @return void
16
     */
17
    public function boot()
18
    {
19
        Storage::extend('upyun', function ($app, $config) {
20
            $adapter = new UpyunAdapter(
21
                $config['bucket'], $config['operator'],
22
                $config['password'],$config['domain'],$config['protocol']
23
            );
24
25
            $filesystem = new Filesystem($adapter);
26
27
            $filesystem->addPlugin(new ImagePreviewUrl());
28
29
            return $filesystem;
30
        });
31
    }
32
33
    /**
34
     * Register the application services.
35
     *
36
     * @return void
37
     */
38
    public function register()
39
    {
40
        //
41
    }
42
}
43