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   A

Complexity

Total Complexity 10

Size/Duplication

Total Lines 85
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 10
c 1
b 0
f 0
lcom 1
cbo 0
dl 0
loc 85
ccs 25
cts 25
cp 1
rs 10

9 Methods

Rating   Name   Duplication   Size   Complexity  
A has() 0 4 1
A set() 0 4 1
A getIterator() 0 4 1
A offsetExists() 0 4 1
A offsetGet() 0 4 1
A offsetSet() 0 4 1
A offsetUnset() 0 4 1
A count() 0 4 1
A get() 0 10 2
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