GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

WebDAVFilesystem   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 69
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 5
c 2
b 0
f 0
lcom 1
cbo 4
dl 0
loc 69
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A init() 0 8 2
A prepareAdapter() 0 22 3
1
<?php
2
/**
3
 * @link https://github.com/creocoder/yii2-flysystem
4
 * @copyright Copyright (c) 2015 Alexander Kochetov
5
 * @license http://opensource.org/licenses/BSD-3-Clause
6
 */
7
8
namespace creocoder\flysystem;
9
10
use League\Flysystem\WebDAV\WebDAVAdapter;
11
use Sabre\DAV\Client;
12
use yii\base\InvalidConfigException;
13
14
/**
15
 * WebDAVFilesystem
16
 *
17
 * @author Alexander Kochetov <[email protected]>
18
 */
19
class WebDAVFilesystem extends Filesystem
20
{
21
    /**
22
     * @var string
23
     */
24
    public $baseUri;
25
    /**
26
     * @var string
27
     */
28
    public $userName;
29
    /**
30
     * @var string
31
     */
32
    public $password;
33
    /**
34
     * @var string
35
     */
36
    public $proxy;
37
    /**
38
     * @var integer
39
     */
40
    public $authType;
41
    /**
42
     * @var integer
43
     */
44
    public $encoding;
45
    /**
46
     * @var string|null
47
     */
48
    public $prefix;
49
50
    /**
51
     * @inheritdoc
52
     */
53
    public function init()
54
    {
55
        if ($this->baseUri === null) {
56
            throw new InvalidConfigException('The "baseUri" property must be set.');
57
        }
58
59
        parent::init();
60
    }
61
62
    /**
63
     * @return WebDAVAdapter
64
     */
65
    protected function prepareAdapter()
66
    {
67
        $config = [];
68
69
        foreach ([
70
            'baseUri',
71
            'userName',
72
            'password',
73
            'proxy',
74
            'authType',
75
            'encoding',
76
        ] as $name) {
77
            if ($this->$name !== null) {
78
                $config[$name] = $this->$name;
79
            }
80
        }
81
82
        return new WebDAVAdapter(
83
            new Client($config),
84
            $this->prefix
85
        );
86
    }
87
}
88