WantuFileServiceProvider   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 11
dl 0
loc 18
rs 10
c 1
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A register() 0 16 1
1
<?php
2
3
namespace XiaohuiLam\LaravelFilesystem\Wantu;
4
5
use League\Flysystem\Config;
6
use League\Flysystem\Filesystem;
7
use Illuminate\Support\ServiceProvider;
8
use XiaohuiLam\LaravelFilesystem\Wantu\Plugins\GetUrl;
9
use XiaohuiLam\LaravelFilesystem\Wantu\Plugins\UploadToken;
10
11
class WantuFileServiceProvider extends ServiceProvider
12
{
13
    public function register()
14
    {
15
        app('filesystem')->extend('wantu', function ($app, $config) {
16
            $adapter = new WantuFileAdapter(
17
                $config['access_key'],
18
                $config['secret_key'],
19
                $config['namespace'],
20
                $config['domain']
21
            );
22
            $flysystem = new Filesystem($adapter, new Config(['disable_asserts' => true]));
23
            // $flysystem->addPlugin(new FetchFile());
24
            $flysystem->addPlugin(new UploadToken());
25
            $flysystem->addPlugin(new GetUrl());
26
            // $flysystem->addPlugin(new PrivateDownloadUrl());
27
            // $flysystem->addPlugin(new RefreshFile());
28
            return $flysystem;
29
        });
30
    }
31
}
32