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.

Delegator   A
last analyzed

Complexity

Total Complexity 8

Size/Duplication

Total Lines 71
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 5

Importance

Changes 0
Metric Value
wmc 8
lcom 2
cbo 5
dl 0
loc 71
rs 10
c 0
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A get() 0 7 2
A has() 0 4 1
A addConfig() 0 4 1
A set() 0 12 2
A hasInRegistry() 0 7 1
A getFromRegistry() 0 7 1
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\Config\Message\Message;
18
use Phossa2\Shared\Base\ObjectAbstract;
19
use Phossa2\Config\Traits\ArrayAccessTrait;
20
use Phossa2\Config\Exception\LogicException;
21
use Phossa2\Config\Interfaces\ConfigInterface;
22
use Phossa2\Config\Interfaces\WritableInterface;
23
use Phossa2\Config\Interfaces\DelegatorInterface;
24
use Phossa2\Config\Traits\DelegatorWritableTrait;
25
use Phossa2\Shared\Delegator\DelegatorAwareTrait;
26
use Phossa2\Shared\Delegator\DelegatorAwareInterface;
27
28
/**
29
 * Delegator
30
 *
31
 * Delegator for config
32
 *
33
 * @package Phossa2\Config
34
 * @author  Hong Zhang <[email protected]>
35
 * @see     ObjectAbstract
36
 * @see     DelegatorInterface
37
 * @see     \ArrayAccess
38
 * @see     WritableInterface
39
 * @version 2.0.12
40
 * @since   2.0.0 added
41
 * @since   2.0.7 changed DelegatorInterface, added ChainingInterface
42
 * @since   2.0.10 removed ChainingInterface
43
 * @since   2.0.12 changed set() return value
44
 */
45
class Delegator extends ObjectAbstract implements DelegatorInterface, \ArrayAccess, WritableInterface, DelegatorAwareInterface
46
{
47
    use ArrayAccessTrait, DelegatorWritableTrait, DelegatorAwareTrait;
48
49
    /**
50
     * {@inheritDoc}
51
     */
52
    public function get(/*# string */ $id, $default = null)
53
    {
54
        if ($this->hasInLookup($id)) {
55
            return $this->getFromLookup($id);
56
        }
57
        return $default;
58
    }
59
60
    /**
61
     * {@inheritDoc}
62
     */
63
    public function has(/*# string */ $id)/*# : bool */
64
    {
65
        return $this->hasInLookup($id);
66
    }
67
68
    /**
69
     * {@inheritDoc}
70
     */
71
    public function addConfig(ConfigInterface $config)
72
    {
73
        return $this->addRegistry($config);
74
    }
75
76
    /**
77
     * @since 2.0.12 changed return value
78
     *
79
     * {@inheritDoc}
80
     */
81
    public function set(/*# string */ $id, $value)/*# : bool */
82
    {
83
        if ($this->isWritable()) {
84
            $this->writable->set($id, $value);
85
            return $this->writable->has($id);
86
        } else {
87
            throw new LogicException(
88
                Message::get(Message::CONFIG_NOT_WRITABLE, $id),
89
                Message::CONFIG_NOT_WRITABLE
90
            );
91
        }
92
    }
93
94
    /**
95
     * {@inheritDoc}
96
     */
97
    protected function hasInRegistry(
98
        $registry,
99
        /*# string */ $id
100
    )/*# : bool */ {
101
        /* @var $registry ConfigInterface */
102
        return $registry->has($id);
103
    }
104
105
    /**
106
     * {@inheritDoc}
107
     */
108
    protected function getFromRegistry(
109
        $registry,
110
        /*# string */ $id
111
    ) {
112
        /* @var $registry ConfigInterface */
113
        return $registry->get($id);
114
    }
115
}
116