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 ( 99078a...9605c1 )
by Oanh
02:49
created

Collection::offsetSet()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1
Metric Value
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 2
crap 1
1
<?php
2
/* (c) Anton Medvedev <[email protected]>
3
 *
4
 * For the full copyright and license information, please view the LICENSE
5
 * file that was distributed with this source code.
6
 */
7
8
namespace Deployer\Collection;
9
10
class Collection implements CollectionInterface, \Countable
11
{
12
    /**
13
     * @var array
14
     */
15
    private $collection = [];
16
17
    /**
18
     * {@inheritdoc}
19
     */
20 46
    public function get($name)
21
    {
22 46
        if ($this->has($name)) {
23 41
            return $this->collection[$name];
24
        } else {
25 5
            $class = explode('\\', get_class($this));
26 5
            $class = end($class);
27 5
            throw new \RuntimeException("Object `$name` does not exist in $class.");
28
        }
29
    }
30
31
    /**
32
     * {@inheritdoc}
33
     */
34 47
    public function has($name)
35
    {
36 47
        return array_key_exists($name, $this->collection);
37
    }
38
39
    /**
40
     * {@inheritdoc}
41
     */
42 42
    public function set($name, $object)
43
    {
44 42
        $this->collection[$name] = $object;
45 42
    }
46
47
    /**
48
     * {@inheritdoc}
49
     */
50 24
    public function getIterator()
51
    {
52 24
        return new \ArrayIterator($this->collection);
53
    }
54
55
    /**
56
     * {@inheritdoc}
57
     */
58 1
    public function offsetExists($offset)
59
    {
60 1
        return $this->has($offset);
61
    }
62
63
    /**
64
     * {@inheritdoc}
65
     */
66 36
    public function offsetGet($offset)
67
    {
68 36
        return $this->get($offset);
69
    }
70
71
    /**
72
     * {@inheritdoc}
73
     */
74 37
    public function offsetSet($offset, $value)
75
    {
76 37
        $this->set($offset, $value);
77 37
    }
78
79
    /**
80
     * {@inheritdoc}
81
     */
82 1
    public function offsetUnset($offset)
83
    {
84 1
        unset($this->collection[$offset]);
85 1
    }
86
87
    /**
88
     * {@inheritdoc}
89
     */
90 2
    public function count()
91
    {
92 2
        return count($this->collection);
93
    }
94
}
95