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.

YiiCache   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 47
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A load() 0 8 2
A save() 0 4 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\Cached\Storage\AbstractCache;
11
use yii\caching\Cache;
12
13
/**
14
 * YiiCache
15
 *
16
 * @author Alexander Kochetov <[email protected]>
17
 */
18
class YiiCache extends AbstractCache
19
{
20
    /**
21
     * @var Cache
22
     */
23
    protected $yiiCache;
24
    /**
25
     * @var string
26
     */
27
    protected $key;
28
    /**
29
     * @var integer
30
     */
31
    protected $duration;
32
33
    /**
34
     * @param Cache $yiiCache
35
     * @param string $key
36
     * @param integer $duration
37
     */
38
    public function __construct(Cache $yiiCache, $key = 'flysystem', $duration = 0)
39
    {
40
        $this->yiiCache = $yiiCache;
41
        $this->key = $key;
42
        $this->duration = $duration;
43
    }
44
45
    /**
46
     * @inheritdoc
47
     */
48
    public function load()
49
    {
50
        $contents = $this->yiiCache->get($this->key);
51
52
        if ($contents !== false) {
53
            $this->setFromStorage($contents);
54
        }
55
    }
56
57
    /**
58
     * @inheritdoc
59
     */
60
    public function save()
61
    {
62
        $this->yiiCache->set($this->key, $this->getForStorage(), $this->duration);
63
    }
64
}
65