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.

AzureFilesystem   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 50
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

Changes 0
Metric Value
wmc 5
c 0
b 0
f 0
lcom 1
cbo 4
dl 0
loc 50
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A init() 0 16 4
A prepareAdapter() 0 11 1
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\Azure\AzureAdapter;
11
use WindowsAzure\Common\ServicesBuilder;
12
use yii\base\InvalidConfigException;
13
14
/**
15
 * AzureFilesystem
16
 *
17
 * @author Alexander Kochetov <[email protected]>
18
 */
19
class AzureFilesystem extends Filesystem
20
{
21
    /**
22
     * @var string
23
     */
24
    public $accountName;
25
    /**
26
     * @var string
27
     */
28
    public $accountKey;
29
    /**
30
     * @var string
31
     */
32
    public $container;
33
34
    /**
35
     * @inheritdoc
36
     */
37
    public function init()
38
    {
39
        if ($this->accountName === null) {
40
            throw new InvalidConfigException('The "accountName" property must be set.');
41
        }
42
43
        if ($this->accountKey === null) {
44
            throw new InvalidConfigException('The "accountKey" property must be set.');
45
        }
46
47
        if ($this->container === null) {
48
            throw new InvalidConfigException('The "container" property must be set.');
49
        }
50
51
        parent::init();
52
    }
53
54
    /**
55
     * @return AzureAdapter
56
     */
57
    protected function prepareAdapter()
58
    {
59
        return new AzureAdapter(
60
            ServicesBuilder::getInstance()->createBlobService(sprintf(
61
                'DefaultEndpointsProtocol=https;AccountName=%s;AccountKey=%s',
62
                base64_encode($this->accountName),
63
                base64_encode($this->accountKey)
64
            )),
65
            $this->container
66
        );
67
    }
68
}
69