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.

Adapters   A
last analyzed

Complexity

Total Complexity 12

Size/Duplication

Total Lines 86
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 18
dl 0
loc 86
rs 10
c 0
b 0
f 0
wmc 12

5 Methods

Rating   Name   Duplication   Size   Complexity  
A validate() 0 7 2
A hasItemPool() 0 3 1
A createItemPool() 0 10 4
A __construct() 0 8 4
A getItemPool() 0 3 1
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;
15
16
// ------------------------------------------------------------------------
17
18
use O2System\Cache\Abstracts\AbstractAdapter;
19
use O2System\Cache\Abstracts\AbstractItemPool;
20
use O2System\Spl\Patterns\Structural\Provider\AbstractProvider;
0 ignored issues
show
Bug introduced by
The type O2System\Spl\Patterns\St...ovider\AbstractProvider was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
21
use O2System\Spl\Patterns\Structural\Provider\ValidationInterface;
0 ignored issues
show
Bug introduced by
The type O2System\Spl\Patterns\St...der\ValidationInterface was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
22
23
/**
24
 * Class Adapters
25
 *
26
 * @package O2System\Cache
27
 */
28
class Adapters extends AbstractProvider implements ValidationInterface
29
{
30
    /**
31
     * Adapters::__construct
32
     *
33
     * @param DataStructures\Config $config
34
     *
35
     * @return Adapters
36
     */
37
    public function __construct(DataStructures\Config $config)
38
    {
39
        if ($config->offsetExists('default')) {
40
            foreach ($config as $poolOffset => $poolConfig) {
41
                $this->createItemPool($poolOffset, $poolConfig);
42
            }
43
        } elseif ($config->offsetExists('adapter')) {
44
            $this->createItemPool('default', $config);
45
        }
46
    }
47
48
    // ------------------------------------------------------------------------
49
50
    /**
51
     * Adapters::createItemPool
52
     *
53
     * Create Item Pool
54
     *
55
     * @param string                $poolOffset
56
     * @param DataStructures\Config $poolConfig
57
     */
58
    public function createItemPool($poolOffset, DataStructures\Config $poolConfig)
59
    {
60
        $adapterClassName = '\O2System\Cache\Adapters\\' . ucfirst($poolConfig->adapter) . '\ItemPool';
0 ignored issues
show
Bug Best Practice introduced by
The property adapter does not exist on O2System\Cache\DataStructures\Config. Since you implemented __get, consider adding a @property annotation.
Loading history...
61
62
        if (class_exists($adapterClassName)) {
63
            $adapter = new $adapterClassName($poolConfig);
64
65
            if ($adapter instanceof AbstractAdapter) {
66
                if ($adapter->isSupported()) {
67
                    $this->register($adapter, $poolOffset);
68
                }
69
            }
70
        }
71
    }
72
73
    // ------------------------------------------------------------------------
74
75
    /**
76
     * Adapters::getItemPool
77
     *
78
     * Gets item pool.
79
     *
80
     * @param string $poolOffset
81
     *
82
     * @return mixed
83
     */
84
    public function &getItemPool($poolOffset)
85
    {
86
        return $this->getObject($poolOffset);
87
    }
88
89
    // ------------------------------------------------------------------------
90
91
    public function hasItemPool($poolOffset)
92
    {
93
        return $this->__isset($poolOffset);
94
    }
95
96
    // ------------------------------------------------------------------------
97
98
    /**
99
     * Adapters::validate
100
     *
101
     * Determine if value is meet requirement.
102
     *
103
     * @param mixed $value
104
     *
105
     * @return bool
106
     */
107
    public function validate($value)
108
    {
109
        if ($value instanceof AbstractItemPool) {
110
            return true;
111
        }
112
113
        return false;
114
    }
115
}