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.

ParamBag   A
last analyzed

↳ Parent: Project

Coupling/Cohesion

Components 1
Dependencies 0

Complexity

Total Complexity 12

Size/Duplication

Total Lines 147
Duplicated Lines 0 %

Test Coverage

Coverage 91.3%

Importance

Changes 0
Metric Value
wmc 12
c 0
b 0
f 0
lcom 1
cbo 0
dl 0
loc 147
ccs 21
cts 23
cp 0.913
rs 10

11 Methods

Rating   Name   Duplication   Size   Complexity  
A get() 0 4 1
A __get() 0 4 2
A __isset() 0 4 1
A offsetSet() 0 4 1
A offsetUnset() 0 4 1
A __construct() 0 4 1
A __set() 0 4 1
A __unset() 0 4 1
A offsetExists() 0 4 1
A offsetGet() 0 4 1
A getIterator() 0 4 1
1
<?php
2
3
/*
4
 * This file is part of the League\Fractal package.
5
 *
6
 * (c) Phil Sturgeon <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace League\Fractal;
13
14
/**
15
 * A handy interface for getting at include parameters.
16
 */
17
class ParamBag implements \ArrayAccess, \IteratorAggregate
18
{
19
    /**
20
     * @var array
21
     */
22
    protected $params = [];
23
24
    /**
25
     * Create a new parameter bag instance.
26
     *
27
     * @param array $params
28
     *
29
     * @return void
30
     */
31 34
    public function __construct(array $params)
32
    {
33 34
        $this->params = $params;
34 34
    }
35
36
    /**
37
     * Get parameter values out of the bag.
38
     *
39
     * @param string $key
40
     *
41
     * @return mixed
42
     */
43 2
    public function get($key)
44
    {
45 2
        return $this->__get($key);
46
    }
47
48
    /**
49
     * Get parameter values out of the bag via the property access magic method.
50
     *
51
     * @param string $key
52
     *
53
     * @return mixed
54
     */
55 5
    public function __get($key)
56
    {
57 5
        return isset($this->params[$key]) ? $this->params[$key] : null;
58
    }
59
60
    /**
61
     * Check if a param exists in the bag via an isset() check on the property.
62
     *
63
     * @param string $key
64
     *
65
     * @return bool
66
     */
67 2
    public function __isset($key)
68
    {
69 2
        return isset($this->params[$key]);
70
    }
71
72
    /**
73
     * Disallow changing the value of params in the data bag via property access.
74
     *
75
     * @param string $key
76
     * @param mixed  $value
77
     *
78
     * @throws \LogicException
79
     *
80
     * @return void
81
     */
82 1
    public function __set($key, $value)
83
    {
84 1
        throw new \LogicException('Modifying parameters is not permitted');
85
    }
86
87
    /**
88
     * Disallow unsetting params in the data bag via property access.
89
     *
90
     * @param string $key
91
     *
92
     * @throws \LogicException
93
     *
94
     * @return void
95
     */
96 1
    public function __unset($key)
97
    {
98 1
        throw new \LogicException('Modifying parameters is not permitted');
99
    }
100
101
    /**
102
     * Check if a param exists in the bag via an isset() and array access.
103
     *
104
     * @param string $key
105
     *
106
     * @return bool
107
     */
108 1
    public function offsetExists($key)
109
    {
110 1
        return $this->__isset($key);
111
    }
112
113
    /**
114
     * Get parameter values out of the bag via array access.
115
     *
116
     * @param string $key
117
     *
118
     * @return mixed
119
     */
120 2
    public function offsetGet($key)
121
    {
122 2
        return $this->__get($key);
123
    }
124
125
    /**
126
     * Disallow changing the value of params in the data bag via array access.
127
     *
128
     * @param string $key
129
     * @param mixed  $value
130
     *
131
     * @throws \LogicException
132
     *
133
     * @return void
134
     */
135 1
    public function offsetSet($key, $value)
136
    {
137 1
        throw new \LogicException('Modifying parameters is not permitted');
138
    }
139
140
    /**
141
     * Disallow unsetting params in the data bag via array access.
142
     *
143
     * @param string $key
144
     *
145
     * @throws \LogicException
146
     *
147
     * @return void
148
     */
149 1
    public function offsetUnset($key)
150
    {
151 1
        throw new \LogicException('Modifying parameters is not permitted');
152
    }
153
154
    /**
155
     * IteratorAggregate for iterating over the object like an array.
156
     *
157
     * @return \ArrayIterator
158
     */
159
    public function getIterator()
160
    {
161
        return new \ArrayIterator($this->params);
162
    }
163
}
164