Commune::addCentre()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 6
rs 9.4285
cc 1
eloc 3
nc 1
nop 1
1
<?php
2
3
namespace SDIS62\Core\Ops\Entity;
4
5
use Doctrine\Common\Collections\ArrayCollection;
6
7
class Commune
8
{
9
    /**
10
     * Code insee de la commune.
11
     *
12
     * @var string
13
     */
14
    protected $numinsee;
15
16
    /**
17
     * Nom de la commune.
18
     *
19
     * @var string
20
     */
21
    protected $name;
22
23
    /**
24
     * Centres sur la commune.
25
     *
26
     * @var SDIS62\Core\Ops\Entity\Centre[]
27
     */
28
    protected $centres;
29
30
    /**
31
     * Création d'une commune.
32
     *
33
     * @param string name
34
     * @param string numinsee
35
     */
36
    public function __construct($name, $numinsee)
37
    {
38
        $this->name     = $name;
39
        $this->numinsee = $numinsee;
40
        $this->centres  = new ArrayCollection();
0 ignored issues
show
Documentation Bug introduced by
It seems like new \Doctrine\Common\Collections\ArrayCollection() of type object<Doctrine\Common\C...ctions\ArrayCollection> is incompatible with the declared type array<integer,object<SDI...ore\Ops\Entity\Centre>> of property $centres.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
41
    }
42
43
    /**
44
     * Get the value of Code insee de la commune.
45
     *
46
     * @return string
47
     */
48
    public function getNuminsee()
49
    {
50
        return $this->numinsee;
51
    }
52
53
    /**
54
     * Get the value of Nom de la commune.
55
     *
56
     * @return string
57
     */
58
    public function getName()
59
    {
60
        return $this->name;
61
    }
62
63
    /**
64
     * Set the value of Nom de la commune.
65
     *
66
     * @param string name
67
     *
68
     * @return self
69
     */
70
    public function setName($name)
71
    {
72
        $this->name = $name;
73
74
        return $this;
75
    }
76
77
    /**
78
     * Retourne les centres sur la commune.
79
     *
80
     * @return SDIS62\Core\Ops\Entity\Centre[]
81
     */
82
    public function getCentres()
83
    {
84
        return $this->centres;
85
    }
86
87
    /**
88
     * Ajoute un centre sur la commune.
89
     *
90
     * @param SDIS62\Core\Ops\Entity\Centre $centre
91
     *
92
     * @return self
93
     */
94
    public function addCentre(Centre $centre)
95
    {
96
        $this->centres[] = $centre;
97
98
        return $this;
99
    }
100
}
101