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.

ApcCache   A
last analyzed

Complexity

Total Complexity 9

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Coupling/Cohesion

Dependencies 0

Importance

Changes 0
Metric Value
wmc 9
cbo 0
dl 0
loc 41
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getKey() 0 4 1
A set() 0 6 2
A get() 0 8 2
A clear() 0 10 4
1
<?php
2
3
namespace Minime\Annotations\Cache;
4
5
use Minime\Annotations\Interfaces\CacheInterface;
6
7
/**
8
 * Apc cache storage implementation
9
 *
10
 * @package Minime\Annotations
11
 * @author [email protected]
12
 */
13
class ApcCache implements CacheInterface
14
{
15
    /**
16
     * Cached annotations
17
     *
18
     * @var array
19
     */
20
    protected $annotations = [];
21
22
    public function getKey($docblock)
23
    {
24
        return 'minime-annotations:' . md5($docblock);
25
    }
26
27
    public function set($key, array $annotations)
28
    {
29
        if (! apc_exists($key)) {
30
            apc_store($key, $annotations);
31
        }
32
    }
33
34
    public function get($key)
35
    {
36
        if (apc_exists($key)) {
37
            return apc_fetch($key);
38
        }
39
40
        return [];
41
    }
42
43
    public function clear()
44
    {
45
        $cache = apc_cache_info('user');
46
        foreach ($cache['cache_list'] as $entry) {
47
            if(isset($entry['info'])
48
               && strpos($entry['info'], 'minime-annotations:') === 0) {
49
                apc_delete($entry['info']);
50
            }
51
        }
52
    }
53
}
54