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.
Completed
Push — master ( e04aee...567320 )
by Hong
03:02
created

Delegator::set()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 3
Bugs 0 Features 0
Metric Value
c 3
b 0
f 0
dl 0
loc 7
rs 9.4285
cc 1
eloc 4
nc 1
nop 2
1
<?php
2
/**
3
 * Phossa Project
4
 *
5
 * PHP version 5.4
6
 *
7
 * @category  Library
8
 * @package   Phossa2\Config
9
 * @copyright Copyright (c) 2016 phossa.com
10
 * @license   http://mit-license.org/ MIT License
11
 * @link      http://www.phossa.com/
12
 */
13
/*# declare(strict_types=1); */
14
15
namespace Phossa2\Config;
16
17
use Phossa2\Shared\Base\ObjectAbstract;
18
use Phossa2\Shared\Reference\DelegatorTrait;
19
use Phossa2\Shared\Reference\DelegatorInterface;
20
21
/**
22
 * Delegator
23
 *
24
 * Implmentation of DelegatorInterface
25
 *
26
 * @package Phossa2\Config
27
 * @author  Hong Zhang <[email protected]>
28
 * @see     ObjectAbstract
29
 * @see     DelegatorInterface
30
 * @version 2.0.0
31
 * @since   2.0.0 added
32
 */
33
class Delegator extends ObjectAbstract implements \ArrayAccess, DelegatorInterface, ConfigInterface
34
{
35
    use ArrayAccessTrait, DelegatorTrait;
36
37
    /**
38
     * constructor
39
     *
40
     * @access public
41
     */
42
    public function __construct()
43
    {
44
        // at least one dummy config registry
45
        (new Config())->setDelegator($this);
46
    }
47
48
    /**
49
     * {@inheritDoc}
50
     */
51
    public function get(/*# string */ $key, $default = null)
52
    {
53
        if ($this->hasInLookup($key)) {
54
            return $this->getFromLookup($key);
55
        }
56
        return $default;
57
    }
58
59
    /**
60
     * {@inheritDoc}
61
     */
62
    public function has(/*# string */ $key)/*# : bool */
63
    {
64
        return $this->hasInLookup($key);
65
    }
66
67
    /**
68
     * {@inheritDoc}
69
     */
70
    public function set(/*# string */ $key, $value)
71
    {
72
        // set with the dummy registry
73
        $reg = $this->lookup_pool[0];
74
        $reg->set($key, $value);
75
        return $this;
76
    }
77
78
    /**
79
     * {@inheritDoc}
80
     */
81
    protected function isValidRegistry($registry)/*# : bool */
82
    {
83
        return $registry instanceof ConfigInterface;
84
    }
85
86
    /**
87
     * {@inheritDoc}
88
     */
89
    protected function hasInRegistry(
90
        $registry,
91
        /*# string */ $key
92
    )/*# : bool */ {
93
        /* @var $registry ConfigInterface */
94
        return $registry->has($key);
95
    }
96
97
    /**
98
     * {@inheritDoc}
99
     */
100
    protected function getFromRegistry(
101
        $registry,
102
        /*# string */ $key
103
    ) {
104
        /* @var $registry ConfigInterface */
105
        return $registry->get($key);
106
    }
107
}
108