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.

Wincache   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 77
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

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

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A retrieve() 0 8 2
A put() 0 4 1
A forever() 0 4 1
A forget() 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 Wincache extends Storage
16
{
17
    /**
18
     * The cache key from the cache configuration file.
19
     *
20
     * @var string
21
     */
22
    protected $key;
23
24
    /**
25
     * @param $key
26
     */
27
    public function __construct($key)
28
    {
29
        $this->key = $key;
30
    }
31
32
    /**
33
     * Retrieve an item from the cache storage.
34
     *
35
     * @param string $key
36
     *
37
     * @return mixed
38
     */
39
    protected function retrieve($key)
40
    {
41
        if (($cache = wincache_ucache_get($this->key . $key)) !== false) {
42
            return $cache;
43
        }
44
45
        return null;
46
    }
47
48
    /**
49
     * Write an item to the cache for a given number of minutes.
50
     *
51
     * <code>
52
     *    // Put an item in the cache for 15 minutes
53
     *    Cache::put('name', 'Robin', 15);
54
     * </code>
55
     *
56
     * @param string $key
57
     * @param mixed  $value
58
     * @param int    $minutes
59
     *
60
     * @return bool|void
61
     */
62
    public function put($key, $value, $minutes)
63
    {
64
        return wincache_ucache_add($this->key . $key, $value, $minutes * 60);
65
    }
66
67
    /**
68
     * Write an item to the cache that lasts forever.
69
     *
70
     * @param $key
71
     * @param $value
72
     *
73
     * @return bool|void
74
     */
75
    public function forever($key, $value)
76
    {
77
        return $this->put($key, $value, 0);
78
    }
79
80
    /**
81
     * Delete an item from the cache.
82
     *
83
     * @param string $key
84
     *
85
     * @return bool|void
86
     */
87
    public function forget($key)
88
    {
89
        return wincache_ucache_delete($this->key . $key);
90
    }
91
}
92