Departement::__toString()   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 1
Metric Value
c 1
b 0
f 1
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace Departements\Model;
4
5
use PhpCollection\Sequence;
6
use PhpCollection\SequenceInterface;
7
8
class Departement
9
{
10
    protected $name;
11
    protected $code;
12
    protected $region;
13
    protected $communes;
14
15
    function __construct () {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
16
        $this->communes = new Sequence();
17
    }
18
19
    public function getName()
20
    {
21
        return $this->name;
22
    }
23
24
    public function setName($name)
25
    {
26
        $this->name = $name;
27
        return $this;
28
    }
29
30
    public function getCode()
31
    {
32
        return $this->code;
33
    }
34
35
    public function setCode($code)
36
    {
37
        $this->code = $code;
38
        return $this;
39
    }
40
41
    public function getRegion()
42
    {
43
        return $this->region;
44
    }
45
46
    public function setRegion(Region $region)
47
    {
48
        $this->region = $region;
49
        return $this;
50
    }
51
52
    public function getCommunes()
53
    {
54
        return $this->communes;
55
    }
56
57
    public function addCommune(Commune $commune) {
58
        $this->communes->add($commune);
59
    }
60
61
    public function setCommunes(SequenceInterface $communes)
62
    {
63
        $this->communes = $communes;
64
    }
65
66
    public function __toString()
67
    {
68
        return $this->getName();
69
    }
70
71
}
72
73