Completed
Pull Request — 6.0 (#2392)
by yun
01:47
created

Local   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Test Coverage

Coverage 90%

Importance

Changes 3
Bugs 1 Features 0
Metric Value
eloc 12
dl 0
loc 23
ccs 9
cts 10
cp 0.9
rs 10
c 3
b 1
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A createAdapter() 0 13 2
1
<?php
2
// +----------------------------------------------------------------------
3
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
4
// +----------------------------------------------------------------------
5
// | Copyright (c) 2006~2019 http://thinkphp.cn All rights reserved.
6
// +----------------------------------------------------------------------
7
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
8
// +----------------------------------------------------------------------
9
// | Author: yunwuxin <[email protected]>
10
// +----------------------------------------------------------------------
11
declare (strict_types = 1);
12
13
namespace think\filesystem\driver;
14
15
use League\Flysystem\AdapterInterface;
16
use League\Flysystem\Adapter\Local as LocalAdapter;
17
use think\filesystem\Driver;
18
19
class Local extends Driver
20
{
21
    /**
22
     * 配置参数
23
     * @var array
24
     */
25
    protected $config = [
26
        'root' => '',
27
    ];
28
29 6
    protected function createAdapter(): AdapterInterface
30
    {
31 6
        $permissions = $this->config['permissions'] ?? [];
32
33 6
        $links = ($this->config['links'] ?? null) === 'skip'
34
        ? LocalAdapter::SKIP_LINKS
35 6
        : LocalAdapter::DISALLOW_LINKS;
36
37 6
        return new LocalAdapter(
38 6
            $this->config['root'],
39 6
            LOCK_EX,
40 4
            $links,
41 4
            $permissions
42
        );
43
    }
44
}
45