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.

ArrayCache   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Coupling/Cohesion

Dependencies 0

Importance

Changes 0
Metric Value
wmc 6
cbo 0
dl 0
loc 36
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 4 1
1
<?php
2
3
namespace Minime\Annotations\Cache;
4
5
use Minime\Annotations\Interfaces\CacheInterface;
6
7
/**
8
 * A memory storage cache implementation
9
 *
10
 * @package Minime\Annotations
11
 */
12
class ArrayCache implements CacheInterface
13
{
14
    /**
15
     * Cached annotations
16
     *
17
     * @var array
18
     */
19
    protected $annotations = [];
20
21
    public function getKey($docblock)
22
    {
23
        return md5($docblock);
24
    }
25
26
    public function set($key, array $annotations)
27
    {
28
        if (! array_key_exists($key, $this->annotations)) {
29
            $this->annotations[$key] = $annotations;
30
        }
31
    }
32
33
    public function get($key)
34
    {
35
        if (array_key_exists($key, $this->annotations)) {
36
            return $this->annotations[$key];
37
        }
38
39
        return [];
40
    }
41
42
    public function clear()
43
    {
44
        $this->annotations = [];
45
    }
46
47
}
48