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.
Completed
Push — master ( 7bf065...13ae28 )
by Axel
02:07
created

MemoryCacheItemPool   A

Complexity

Total Complexity 17

Size/Duplication

Total Lines 98
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 97.37%

Importance

Changes 0
Metric Value
wmc 17
c 0
b 0
f 0
lcom 1
cbo 2
dl 0
loc 98
ccs 37
cts 38
cp 0.9737
rs 10

9 Methods

Rating   Name   Duplication   Size   Complexity  
A save() 0 5 1
A saveDeferred() 0 5 1
A hasItem() 0 3 1
A getItem() 0 6 2
A clear() 0 5 1
A deleteItem() 0 9 3
A deleteItems() 0 8 3
A commit() 0 7 2
A getItems() 0 9 3
1
<?php
2
3
namespace PhpAbac\Cache\Pool;
4
5
use Psr\Cache\CacheItemPoolInterface;
6
use Psr\Cache\CacheItemInterface;
7
8
use PhpAbac\Cache\Item\MemoryCacheItem;
9
10
class MemoryCacheItemPool implements CacheItemPoolInterface {
11
    /** @var array **/
12
    protected $items;
13
    /** @var array **/
14
    protected $deferredItems;
15
    /**
16
     * {@inheritdoc}
17
     */
18 2
    public function deleteItem($key) {
19 2
        if(isset($this->items[$key])) {
0 ignored issues
show
Coding Style introduced by
Expected 1 space after IF keyword; 0 found
Loading history...
20 2
            unset($this->items[$key]);
21
        }
22 2
        if(isset($this->deferredItems[$key])) {
0 ignored issues
show
Coding Style introduced by
Expected 1 space after IF keyword; 0 found
Loading history...
23
            unset($this->deferredItems[$key]);
24
        }
25 2
        return true;
26
    }
27
    
28
    /**
29
     * {@inheritdoc}
30
     */
31 1
    public function deleteItems(array $keys) {
32 1
        foreach($keys as $key) {
0 ignored issues
show
Coding Style introduced by
Expected 1 space after FOREACH keyword; 0 found
Loading history...
33 1
            if(!$this->deleteItem($key)) {
0 ignored issues
show
Coding Style introduced by
Expected 1 space after IF keyword; 0 found
Loading history...
34 1
                return false;
35
            }
36
        }
37 1
        return true;
38
    }
39
    
40
    /**
41
     * {@inheritdoc}
42
     */
43 9
    public function save(CacheItemInterface $item) {
44 9
        $this->items[$item->getKey()] = $item;
45
        
46 9
        return true;
47
    }
48
    
49
    /**
50
     * {@inheritdoc}
51
     */
52 2
    public function saveDeferred(CacheItemInterface $item) {
53 2
        $this->deferredItems[$item->getKey()] = $item;
54
        
55 2
        return true;
56
    }
57
    
58
    /**
59
     * {@inheritdoc}
60
     */
61 2
    public function commit() {
62 2
        foreach($this->deferredItems as $key => $item) {
0 ignored issues
show
Coding Style introduced by
Expected 1 space after FOREACH keyword; 0 found
Loading history...
63 2
            $this->items[$key] = $item;
64 2
            unset($this->deferredItems[$key]);
65
        }
66 2
        return true;
67
    }
68
    
69
    /**
70
     * {@inheritdoc}
71
     */
72 13
    public function hasItem($key) {
73 13
        return isset($this->items[$key]);
74
    }
75
    
76
    /**
77
     * {@inheritdoc}
78
     */
79 9
    public function getItem($key) {
80 9
        if(!$this->hasItem($key)) {
0 ignored issues
show
Coding Style introduced by
Expected 1 space after IF keyword; 0 found
Loading history...
81 4
            return new MemoryCacheItem($key);
82
        }
83 7
        return $this->items[$key];
84
    }
85
    
86
    /**
87
     * {@inheritdoc}
88
     */
89 3
    public function getItems(array $keys = array()) {
90 3
        $items = [];
91 3
        foreach($keys as $key) {
0 ignored issues
show
Coding Style introduced by
Expected 1 space after FOREACH keyword; 0 found
Loading history...
92 3
            if($this->hasItem($key)) {
0 ignored issues
show
Coding Style introduced by
Expected 1 space after IF keyword; 0 found
Loading history...
93 3
                $items[$key] = $this->getItem($key);
94
            }
95
        }
96 3
        return $items;
97
    }
98
    
99
    /**
100
     * {@inheritdoc}
101
     */
102 1
    public function clear() {
103 1
        $this->items = [];
104 1
        $this->deferredItems = [];
105 1
        return true;
106
    }
107
}