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.

Config   A
last analyzed

Complexity

Total Complexity 8

Size/Duplication

Total Lines 49
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
dl 0
loc 49
rs 10
c 0
b 0
f 0
wmc 8
lcom 1
cbo 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A load() 0 6 3
A get() 0 19 5
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
namespace Pimf;
9
10
/**
11
 * A well-known object that other objects can use to find common objects and services.
12
 *
13
 * @package Pimf
14
 * @author  Gjero Krsteski <[email protected]>
15
 */
16
class Config
17
{
18
19
    /**
20
     * The temporary storage for the accumulator.
21
     *
22
     * @var \ArrayObject
23
     */
24
    protected static $battery;
25
26
    /**
27
     * @param array $config
28
     * @param bool  $override Used for testing only!
29
     */
30
    public static function load(array $config, $override = false)
31
    {
32
        if (!self::$battery || $override === true) {
33
            self::$battery = new \ArrayObject($config, \ArrayObject::STD_PROP_LIST + \ArrayObject::ARRAY_AS_PROPS);
34
        }
35
    }
36
37
    /**
38
     * Get an item from an array using "dot" notation.
39
     *
40
     * @param string|integer $index The index or identifier.
41
     * @param mixed          $default
42
     *
43
     * @return mixed|null
44
     */
45
    public static function get($index, $default = null)
46
    {
47
        if (self::$battery->offsetExists($index)) {
48
            return self::$battery->offsetGet($index);
49
        }
50
51
        $array = self::$battery->getArrayCopy();
52
53
        foreach ((array)explode('.', $index) as $segment) {
54
55
            if (!is_array($array) || !array_key_exists($segment, $array)) {
56
                return $default;
57
            }
58
59
            $array = $array[$segment];
60
        }
61
62
        return $array;
63
    }
64
}
65