Departement   A
last analyzed

Complexity

Total Complexity 11

Size/Duplication

Total Lines 64
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 4
Bugs 0 Features 3
Metric Value
wmc 11
c 4
b 0
f 3
lcom 1
cbo 2
dl 0
loc 64
rs 10

11 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A getName() 0 4 1
A setName() 0 5 1
A getCode() 0 4 1
A setCode() 0 5 1
A getRegion() 0 4 1
A setRegion() 0 5 1
A getCommunes() 0 4 1
A addCommune() 0 3 1
A setCommunes() 0 4 1
A __toString() 0 4 1
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