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::prepareAdapter()   A
last analyzed

Complexity

Conditions 3
Paths 3

Size

Total Lines 22
Code Lines 15

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 22
rs 9.2
cc 3
eloc 15
nc 3
nop 0
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