Region::getCode()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
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