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 ( a6816c...6bbc5d )
by Carsten
07:55 queued 12s
created

ItemCodes::count()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 1
1
<?php
2
namespace Germania\Nav\ItemCodes;
3
4
use Germania\Nav\ItemCodes\Exceptions\ItemCodeNotFoundException;
5
6
use Psr\Container\ContainerInterface;
7
8
class ItemCodes implements ContainerInterface, \Countable, \IteratorAggregate
9
{
10
11
    /**
12
     * @var ItemCodeInterface[]
13
     */
14
    public $item_codes = array();
15
16
17 8
    public function push (ItemCodeInterface $item )
18
    {
19 8
        $this->item_codes[ $item->getCode() ] = $item;
20 8
        return $this;
21
    }
22
23
    /**
24
     * @param  string $code
25
     * @return ItemCodeNotFoundException
26
     */
27 8
    public function get($code)
28
    {
29 8
        if (!$this->has($code)):
30 4
            throw new ItemCodeNotFoundException( "Could not find Item code '$code'." );
31
        endif;
32
33 4
        return $this->item_codes[ $code ];
34
    }
35
36
    /**
37
     * @param  string $code
38
     * @return boolean
39
     */
40 8
    public function has($code)
41
    {
42 8
        return array_key_exists($code, $this->item_codes);
43
    }
44
45
46
    /**
47
     * @return int
48
     */
49 12
    public function count()
50
    {
51 12
        return count($this->item_codes);
52
    }
53
54
    /**
55
     * @return ArrayIterator
56
     */
57 16
    public function getIterator()
58
    {
59 16
        return new \ArrayIterator( $this->item_codes );
60
    }
61
}
62