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.

Adapter::isConnected()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * This file is part of the O2System Framework package.
4
 *
5
 * For the full copyright and license information, please view the LICENSE
6
 * file that was distributed with this source code.
7
 *
8
 * @author         Steeve Andrian Salim
9
 * @copyright      Copyright (c) Steeve Andrian Salim
10
 */
11
12
// ------------------------------------------------------------------------
13
14
namespace O2System\Cache\Adapters\Apcu;
15
16
// ------------------------------------------------------------------------
17
18
use O2System\Cache\Abstracts\AbstractAdapter;
19
20
/**
21
 * Class Adapter
22
 *
23
 * @package O2System\Cache\Adapters\Apc
24
 */
25
abstract class Adapter extends AbstractAdapter
26
{
27
    /**
28
     * Adapter::$platform
29
     *
30
     * Adapter Platform Name
31
     *
32
     * @var string
33
     */
34
    protected $platform = 'APC User Cache (APCu)';
35
36
    // ------------------------------------------------------------------------
37
38
    /**
39
     * Adapter::connect
40
     *
41
     * @param array $config Cache adapter connection configuration.
42
     *
43
     * @return void
44
     */
45
    public function connect(array $config)
46
    {
47
        $this->config = $config;
48
49
        // APCu adapter do not require further processing.
50
    }
51
52
    // ------------------------------------------------------------------------
53
54
    /**
55
     * Adapter::increment
56
     *
57
     * Increment a raw value offset.
58
     *
59
     * @param string $key  Cache item key.
60
     * @param int    $step Increment step to add.
61
     *
62
     * @return bool
63
     */
64
    public function increment($key, $step = 1)
65
    {
66
        $success = false;
67
        apcu_inc($this->prefixKey . $key, $step, $success);
68
69
        return $success;
70
    }
71
72
    // ------------------------------------------------------------------------
73
74
    /**
75
     * Adapter::decrement
76
     *
77
     * Decrement a raw value offset.
78
     *
79
     * @param string $key  Cache item key.
80
     * @param int    $step Decrement step to add.
81
     *
82
     * @return mixed New value on success or FALSE on failure.
83
     */
84
    public function decrement($key, $step = 1)
85
    {
86
        $success = false;
87
        apcu_dec($this->prefixKey . $key, $step, $success);
88
89
        return $success;
90
    }
91
92
    // ------------------------------------------------------------------------
93
94
    /**
95
     * Adapter::getInfo
96
     *
97
     * Gets item pool adapter info.
98
     *
99
     * @return mixed
100
     */
101
    public function getInfo()
102
    {
103
        @list($limited) = func_get_args();
104
105
        return apcu_cache_info(@$limited);
106
    }
107
108
    // ------------------------------------------------------------------------
109
110
    /**
111
     * Adapter::getInfo
112
     *
113
     * Gets item pool adapter stats.
114
     *
115
     * @return mixed
116
     */
117
    public function getStats()
118
    {
119
        @list($limited) = func_get_args();
120
121
        return apcu_sma_info(@$limited);
122
    }
123
124
    // ------------------------------------------------------------------------
125
126
    /**
127
     * Adapter::isSupported
128
     *
129
     * Checks if this adapter is supported on this system.
130
     *
131
     * @return bool Returns FALSE if not supported.
132
     */
133
    public function isSupported()
134
    {
135
        return (bool)(extension_loaded('apcu') && ini_get('apc.enabled'));
136
    }
137
138
    /**
139
     * Adapter::isConnected
140
     *
141
     * Checks if this adapter has a successful connection.
142
     *
143
     * @return bool Returns FALSE if not supported.
144
     */
145
    public function isConnected()
146
    {
147
        return (bool)function_exists('apcu_cache_info');
148
    }
149
}