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\Wincache;
15
16
// ------------------------------------------------------------------------
17
18
use O2System\Cache\Abstracts\AbstractAdapter;
19
20
/**
21
 * Class Adapter
22
 *
23
 * @package O2System\Cache\Adapters\File
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 = 'Windows Cache';
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
        // Wincache 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 mixed Returns the incremented value on success and FALSE on failure.
63
     */
64
    public function increment($key, $step = 1)
65
    {
66
        $success = false;
67
68
        return wincache_ucache_inc($this->prefixKey . $key, $step, $success);
69
    }
70
71
    // ------------------------------------------------------------------------
72
73
    /**
74
     * Adapter::decrement
75
     *
76
     * Decrement a raw value offset.
77
     *
78
     * @param string $key  Cache item key.
79
     * @param int    $step Decrement step to add.
80
     *
81
     * @return mixed New value on success or FALSE on failure.
82
     */
83
    public function decrement($key, $step = 1)
84
    {
85
        $success = false;
86
87
        return wincache_ucache_dec($this->prefixKey . $key, $step, $success);
88
    }
89
90
    // ------------------------------------------------------------------------
91
92
    /**
93
     * Adapter::getInfo
94
     *
95
     * Gets item pool adapter info.
96
     *
97
     * @return mixed
98
     */
99
    public function getInfo()
100
    {
101
        @list($summaryOnly, $key) = func_get_args();
102
103
        return wincache_ucache_info(@$summaryOnly, @$key);
104
    }
105
106
    // ------------------------------------------------------------------------
107
108
    /**
109
     * Adapter::getInfo
110
     *
111
     * Gets item pool adapter stats.
112
     *
113
     * @return mixed
114
     */
115
    public function getStats()
116
    {
117
        return wincache_ucache_meminfo();
118
    }
119
120
    // ------------------------------------------------------------------------
121
122
    /**
123
     * Adapter::isSupported
124
     *
125
     * Checks if this adapter is supported on this system.
126
     *
127
     * @return bool Returns FALSE if not supported.
128
     */
129
    public function isSupported()
130
    {
131
        return (bool)(extension_loaded('wincache') && ini_get('wincache.ucenabled'));
132
    }
133
134
    // ------------------------------------------------------------------------
135
136
    /**
137
     * Adapter::isConnected
138
     *
139
     * Checks if this adapter has a successful connection.
140
     *
141
     * @return bool Returns FALSE if not supported.
142
     */
143
    public function isConnected()
144
    {
145
        return (bool)(function_exists('wincache_ucache_meminfo'));
146
    }
147
}