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.

Memory   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 71
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 71
rs 10
c 0
b 0
f 0
wmc 6
lcom 1
cbo 1

5 Methods

Rating   Name   Duplication   Size   Complexity  
A retrieve() 0 8 2
A put() 0 4 1
A forever() 0 4 1
A forget() 0 4 1
A flush() 0 4 1
1
<?php
2
/**
3
 * Pimf
4
 *
5
 * @copyright Copyright (c)  Gjero Krsteski (http://krsteski.de)
6
 * @license   http://opensource.org/licenses/MIT MIT License
7
 */
8
9
namespace Pimf\Cache\Storages;
10
11
/**
12
 * @package Cache_Storages
13
 * @author  Gjero Krsteski <[email protected]>
14
 */
15
class Memory extends Storage
16
{
17
    /**
18
     * The in-memory array of cached items.
19
     *
20
     * @var array
21
     */
22
    public $storage = array();
23
24
    /**
25
     * Retrieve an item from the cache storage.
26
     *
27
     * @param string $key
28
     *
29
     * @return mixed|null
30
     */
31
    protected function retrieve($key)
32
    {
33
        if (array_key_exists($key, $this->storage)) {
34
            return $this->storage[$key];
35
        }
36
37
        return null;
38
    }
39
40
    /**
41
     * Write an item to the cache for a given number of minutes.
42
     *
43
     * <code>
44
     *    // Put an item in the cache for 15 minutes
45
     *    Cache::put('name', 'Robin', 15);
46
     * </code>
47
     *
48
     * @param string $key
49
     * @param mixed  $value
50
     * @param int    $minutes
51
     */
52
    public function put($key, $value, $minutes)
53
    {
54
        $this->storage[$key] = $value;
55
    }
56
57
    /**
58
     * Write an item to the cache that lasts forever.
59
     *
60
     * @param $key
61
     * @param $value
62
     */
63
    public function forever($key, $value)
64
    {
65
        $this->put($key, $value, 0);
66
    }
67
68
    /**
69
     * Delete an item from the cache.
70
     *
71
     * @param string $key
72
     */
73
    public function forget($key)
74
    {
75
        unset($this->storage[$key]);
76
    }
77
78
    /**
79
     * Flush the entire cache.
80
     */
81
    public function flush()
82
    {
83
        $this->storage = array();
84
    }
85
}
86