Completed
Push — 6.0 ( c6d21a...a43f83 )
by yun
15:10 queued 11:06
created

Local::createAdapter()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 2.0116

Importance

Changes 0
Metric Value
cc 2
eloc 6
nc 2
nop 0
dl 0
loc 10
ccs 6
cts 7
cp 0.8571
crap 2.0116
rs 10
c 0
b 0
f 0
1
<?php
2
0 ignored issues
show
Coding Style introduced by
Missing file doc comment
Loading history...
3
namespace think\filesystem\driver;
4
5
use League\Flysystem\Adapter\Local as LocalAdapter;
6
use League\Flysystem\AdapterInterface;
7
use think\filesystem\Driver;
8
9
class Local extends Driver
1 ignored issue
show
Coding Style introduced by
Missing doc comment for class Local
Loading history...
10
{
11
12
    protected $config = [
13
        'root' => '',
14
    ];
15
16 2
    protected function createAdapter(): AdapterInterface
0 ignored issues
show
Coding Style introduced by
Missing doc comment for function createAdapter()
Loading history...
17
    {
18 2
        $permissions = $this->config['permissions'] ?? [];
19
20 2
        $links = ($this->config['links'] ?? null) === 'skip'
21
            ? LocalAdapter::SKIP_LINKS
22 2
            : LocalAdapter::DISALLOW_LINKS;
23
24 2
        return new LocalAdapter(
25 2
            $this->config['root'], LOCK_EX, $links, $permissions
0 ignored issues
show
Bug introduced by
It seems like $permissions can also be of type string; however, parameter $permissions of League\Flysystem\Adapter\Local::__construct() does only seem to accept array, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

25
            $this->config['root'], LOCK_EX, $links, /** @scrutinizer ignore-type */ $permissions
Loading history...
26
        );
27
    }
28
}
29