Centre::getMateriels()   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 SDIS62\Core\Ops\Entity;
4
5
use Doctrine\Common\Collections\ArrayCollection;
6
use SDIS62\Core\Common\Entity\IdentityTrait;
7
8
class Centre
9
{
10
    use IdentityTrait;
11
12
    /**
13
     * Nom du centre.
14
     *
15
     * @var string
16
     */
17
    protected $name;
18
19
    /**
20
     * Classement du centre.
21
     *
22
     * @var string
23
     */
24
    protected $classement;
25
26
    /**
27
     * Matériels du centre.
28
     *
29
     * @var SDIS62\Core\Ops\Entity\Materiel[]
30
     */
31
    protected $materiels;
32
33
    /**
34
     * Pompiers du centre.
35
     *
36
     * @var SDIS62\Core\Ops\Entity\Pompier[]
37
     */
38
    protected $pompiers;
39
40
    /**
41
     * Commune du centre.
42
     *
43
     * @var SDIS62\Core\Ops\Entity\Commune
44
     */
45
    protected $commune;
46
47
    /**
48
     * Création d'un centre.
49
     *
50
     * @param string name
51
     */
52
    public function __construct(Commune $commune, $name, $classement = 'CSP')
53
    {
54
        $this->name       = $name;
55
        $this->classement = $classement;
56
        $this->commune    = $commune;
0 ignored issues
show
Documentation Bug introduced by
It seems like $commune of type object<SDIS62\Core\Ops\Entity\Commune> is incompatible with the declared type object<SDIS62\Core\Ops\E...ore\Ops\Entity\Commune> of property $commune.

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...
57
        $this->commune->addCentre($this);
58
        $this->materiels = 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...e\Ops\Entity\Materiel>> of property $materiels.

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...
59
        $this->pompiers  = 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...re\Ops\Entity\Pompier>> of property $pompiers.

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...
60
    }
61
62
    /**
63
     * Get the value of Nom du centre.
64
     *
65
     * @return string
66
     */
67
    public function getName()
68
    {
69
        return $this->name;
70
    }
71
72
    /**
73
     * Set the value of Nom du centre.
74
     *
75
     * @param string name
76
     *
77
     * @return self
78
     */
79
    public function setName($name)
80
    {
81
        $this->name = $name;
82
83
        return $this;
84
    }
85
86
    /**
87
     * Get the value of Matériels du centre.
88
     *
89
     * @return SDIS62\Core\Ops\Entity\Materiel[]
90
     */
91
    public function getMateriels()
92
    {
93
        return $this->materiels;
94
    }
95
96
    /**
97
     * Ajoute un matériel au centre.
98
     *
99
     * @param SDIS62\Core\Ops\Entity\Materiel $materiel
100
     *
101
     * @return self
102
     */
103
    public function addMateriel(Materiel $materiel)
104
    {
105
        $this->materiels[] = $materiel;
106
107
        return $this;
108
    }
109
110
    /**
111
     * Retourne les pompiers.
112
     *
113
     * @return SDIS62\Core\Ops\Entity\Pompier[]
114
     */
115
    public function getPompiers()
116
    {
117
        return $this->pompiers;
118
    }
119
120
    /**
121
     * Ajoute un pompier au centre.
122
     *
123
     * @param SDIS62\Core\Ops\Entity\Pompier $pompier
124
     *
125
     * @return self
126
     */
127
    public function addPompier(Pompier $pompier)
128
    {
129
        $this->pompiers[] = $pompier;
130
131
        return $this;
132
    }
133
134
    /**
135
     * Get the value of commune du centre.
136
     *
137
     * @return SDIS62\Core\Ops\Entity\Commune
138
     */
139
    public function getCommune()
140
    {
141
        return $this->commune;
142
    }
143
144
    /**
145
     * Get the value of Classement du centre.
146
     *
147
     * @return string
148
     */
149
    public function getClassement()
150
    {
151
        return $this->classement;
152
    }
153
154
    /**
155
     * Set the value of Classement du centre.
156
     *
157
     * @param string classement
158
     *
159
     * @return self
160
     */
161
    public function setClassement($classement)
162
    {
163
        $this->classement = $classement;
164
165
        return $this;
166
    }
167
}
168