Websites   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 53
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 5
lcom 1
cbo 1
dl 0
loc 53
ccs 10
cts 10
cp 1
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A get() 0 7 2
A has() 0 4 1
A getIterator() 0 4 1
A count() 0 4 1
1
<?php
2
namespace Germania\Websites;
3
4
class Websites implements WebsitesInterface
5
{
6
7
    /**
8
     * @var array
9
     */
10
    public $websites = array();
11
12
13
    /**
14
     * @return UserInterface
15
     * @throws WebsiteNotFoundException
16
     * @uses   $websites
17
     */
18 15
    public function get( $id )
19
    {
20 15
        if ($this->has( $id )) {
21 10
            return $this->websites[ $id ];
22
        }
23 5
        throw new WebsiteNotFoundException("Could not find Website with ID '$id'");
24
    }
25
26
27
    /**
28
     * @return boolean
29
     * @uses   $websites
30
     */
31 20
    public function has ($id )
32
    {
33 20
        return array_key_exists( $id, $this->websites);
34
    }
35
36
37
38
    /**
39
     * @return ArrayIterator
40
     * @uses   $websites
41
     */
42 5
    public function getIterator()
43
    {
44 5
        return new \ArrayIterator( $this->websites );
45
    }
46
47
48
    /**
49
     * @return int
50
     * @uses   $websites
51
     */
52 5
    public function count()
53
    {
54 5
        return count($this->websites);
55
    }
56
}
57