Region   A
last analyzed

Complexity

Total Complexity 9

Size/Duplication

Total Lines 53
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 2
Bugs 0 Features 1
Metric Value
wmc 9
c 2
b 0
f 1
lcom 1
cbo 3
dl 0
loc 53
rs 10

9 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A addDepartement() 0 4 1
A getDepartements() 0 4 1
A setDepartements() 0 5 1
A getName() 0 4 1
A setName() 0 5 1
A getCode() 0 4 1
A setCode() 0 5 1
A __toString() 0 4 1
1
<?php
2
3
namespace Departements\Model;
4
5
use Departements\Model;
6
use PhpCollection\Map;
7
use PhpCollection\MapInterface;
8
9
class Region
10
{
11
    private $departements;
12
    private $name;
13
    private $code;
14
15
    public function __construct() {
16
        $this->departements = new Map();
17
    }
18
19
    public function addDepartement(Departement $departement) {
20
        $this->departements->set($departement->getCode(), $departement);
21
        return $this;
22
    }
23
24
    public function getDepartements()
25
    {
26
        return $this->departements;
27
    }
28
29
    public function setDepartements(MapInterface $departements)
30
    {
31
        $this->departements = $departements;
32
        return $this;
33
    }
34
35
    public function getName()
36
    {
37
        return $this->name;
38
    }
39
40
    public function setName($name)
41
    {
42
        $this->name = $name;
43
        return $this;
44
    }
45
46
    public function getCode()
47
    {
48
        return $this->code;
49
    }
50
51
    public function setCode($code)
52
    {
53
        $this->code = $code;
54
        return $this;
55
    }
56
57
    public function __toString()
58
    {
59
        return $this->getName();
60
    }
61
}
62
63