Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
64.71% |
33 / 51 |
|
69.23% |
27 / 39 |
CRAP | |
0.00% |
0 / 1 |
AnalyseImpact | |
64.71% |
33 / 51 |
|
69.23% |
27 / 39 |
124.29 | |
0.00% |
0 / 1 |
__construct | |
100.00% |
7 / 7 |
|
100.00% |
1 / 1 |
1 | |||
__toString | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
getId | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
getStatut | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
setStatut | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
getConformiteTraitement | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
setConformiteTraitement | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
getModeleAnalyse | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
setModeleAnalyse | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
getCriterePrincipeFondamentaux | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
getCriterePrincipeFondamentalByCode | |
0.00% |
0 / 4 |
|
0.00% |
0 / 1 |
12 | |||
setCriterePrincipeFondamentaux | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
getQuestionConformites | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
getQuestionConformitesOfName | |
0.00% |
0 / 4 |
|
0.00% |
0 / 1 |
12 | |||
setQuestionConformites | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getDateValidation | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
setDateValidation | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
getScenarioMenaces | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
setScenarioMenaces | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
isReadyForValidation | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
setIsReadyForValidation | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
getAvisReferent | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
setAvisReferent | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getAvisDpd | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
setAvisDpd | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getAvisRepresentant | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
setAvisRepresentant | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getAvisResponsable | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
setAvisResponsable | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
isValidated | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
setIsValidated | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
setMesureProtections | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getMesureProtections | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
getLabelAmeliorationPrevue | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
setLabelAmeliorationPrevue | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getLabelInsatisfaisant | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
setLabelInsatisfaisant | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getLabelSatisfaisant | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
setLabelSatisfaisant | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 |
1 | <?php |
2 | |
3 | declare(strict_types=1); |
4 | |
5 | namespace App\Domain\AIPD\Model; |
6 | |
7 | use App\Application\Traits\Model\HistoryTrait; |
8 | use App\Domain\AIPD\Dictionary\StatutAnalyseImpactDictionary; |
9 | use App\Domain\Registry\Exception\QuestionConformiteNotFoundException; |
10 | use App\Domain\Registry\Model\ConformiteTraitement\ConformiteTraitement; |
11 | use Doctrine\Common\Collections\ArrayCollection; |
12 | use Ramsey\Uuid\Uuid; |
13 | use Ramsey\Uuid\UuidInterface; |
14 | |
15 | class AnalyseImpact |
16 | { |
17 | use HistoryTrait; |
18 | |
19 | private UuidInterface $id; |
20 | |
21 | /** |
22 | * @see StatutAnalyseImpactDictionary |
23 | */ |
24 | private string $statut; |
25 | |
26 | private ConformiteTraitement $conformiteTraitement; |
27 | |
28 | /** |
29 | * Since any changes on the ModeleAnalyse should not be repercuted on the AnalyseImpact, |
30 | * we store only the name of the ModeleAnalyse for information purposes. |
31 | */ |
32 | private string $modeleAnalyse = ''; |
33 | |
34 | private string $labelAmeliorationPrevue = ''; |
35 | |
36 | private string $labelInsatisfaisant = ''; |
37 | |
38 | private string $labelSatisfaisant = ''; |
39 | |
40 | /** |
41 | * @var array|CriterePrincipeFondamental[] |
42 | */ |
43 | private $criterePrincipeFondamentaux; |
44 | |
45 | /** |
46 | * @var array|AnalyseQuestionConformite[] |
47 | */ |
48 | private $questionConformites; |
49 | |
50 | /** |
51 | * @var array|AnalyseScenarioMenace[] |
52 | */ |
53 | private $scenarioMenaces; |
54 | |
55 | private ?\DateTime $dateValidation; |
56 | |
57 | /** |
58 | * @var array|AnalyseMesureProtection[] |
59 | */ |
60 | private $mesureProtections; |
61 | |
62 | private bool $isReadyForValidation = false; |
63 | |
64 | private AnalyseAvis $avisReferent; |
65 | private AnalyseAvis $avisDpd; |
66 | private AnalyseAvis $avisRepresentant; |
67 | private AnalyseAvis $avisResponsable; |
68 | |
69 | private $isValidated = false; |
70 | |
71 | public function __construct() |
72 | { |
73 | $this->id = Uuid::uuid4(); |
74 | $this->statut = StatutAnalyseImpactDictionary::EN_COURS; |
75 | $this->avisReferent = new AnalyseAvis(); |
76 | $this->avisDpd = new AnalyseAvis(); |
77 | $this->avisRepresentant = new AnalyseAvis(); |
78 | $this->avisResponsable = new AnalyseAvis(); |
79 | $this->mesureProtections = new ArrayCollection(); |
80 | } |
81 | |
82 | public function __toString() |
83 | { |
84 | return $this->conformiteTraitement->getTraitement()->getName() . ' du ' . date_format($this->createdAt, 'd/m/Y'); |
85 | } |
86 | |
87 | public function getId(): UuidInterface |
88 | { |
89 | return $this->id; |
90 | } |
91 | |
92 | public function getStatut(): string |
93 | { |
94 | return $this->statut; |
95 | } |
96 | |
97 | public function setStatut(string $statut): void |
98 | { |
99 | $this->statut = $statut; |
100 | } |
101 | |
102 | public function getConformiteTraitement(): ConformiteTraitement |
103 | { |
104 | return $this->conformiteTraitement; |
105 | } |
106 | |
107 | public function setConformiteTraitement(ConformiteTraitement $conformiteTraitement): void |
108 | { |
109 | $this->conformiteTraitement = $conformiteTraitement; |
110 | } |
111 | |
112 | public function getModeleAnalyse(): string |
113 | { |
114 | return $this->modeleAnalyse; |
115 | } |
116 | |
117 | public function setModeleAnalyse(string $modeleAnalyse): void |
118 | { |
119 | $this->modeleAnalyse = $modeleAnalyse; |
120 | } |
121 | |
122 | public function getCriterePrincipeFondamentaux() |
123 | { |
124 | return $this->criterePrincipeFondamentaux; |
125 | } |
126 | |
127 | public function getCriterePrincipeFondamentalByCode($code): ?CriterePrincipeFondamental |
128 | { |
129 | foreach ($this->criterePrincipeFondamentaux as $critere) { |
130 | if ($critere->getCode() === $code) { |
131 | return $critere; |
132 | } |
133 | } |
134 | |
135 | return null; |
136 | } |
137 | |
138 | public function setCriterePrincipeFondamentaux($criterePrincipeFondamentaux): void |
139 | { |
140 | $this->criterePrincipeFondamentaux = $criterePrincipeFondamentaux; |
141 | } |
142 | |
143 | public function getQuestionConformites() |
144 | { |
145 | return $this->questionConformites; |
146 | } |
147 | |
148 | /** |
149 | * @throws QuestionConformiteNotFoundException |
150 | */ |
151 | public function getQuestionConformitesOfName(string $name): AnalyseQuestionConformite |
152 | { |
153 | foreach ($this->questionConformites as $question) { |
154 | if ($question->getQuestion() === $name) { |
155 | return $question; |
156 | } |
157 | } |
158 | |
159 | throw new QuestionConformiteNotFoundException('Question not found for question ' . $name); |
160 | } |
161 | |
162 | public function setQuestionConformites($questionConformites): void |
163 | { |
164 | $this->questionConformites = $questionConformites; |
165 | } |
166 | |
167 | public function getDateValidation(): ?\DateTime |
168 | { |
169 | return $this->dateValidation; |
170 | } |
171 | |
172 | public function setDateValidation(?\DateTime $dateValidation): void |
173 | { |
174 | $this->dateValidation = $dateValidation; |
175 | } |
176 | |
177 | public function getScenarioMenaces() |
178 | { |
179 | return $this->scenarioMenaces; |
180 | } |
181 | |
182 | public function setScenarioMenaces($scenarioMenaces): void |
183 | { |
184 | $this->scenarioMenaces = $scenarioMenaces; |
185 | } |
186 | |
187 | public function isReadyForValidation(): bool |
188 | { |
189 | return $this->isReadyForValidation; |
190 | } |
191 | |
192 | public function setIsReadyForValidation(bool $isReadyForValidation): void |
193 | { |
194 | $this->isReadyForValidation = $isReadyForValidation; |
195 | } |
196 | |
197 | public function getAvisReferent(): AnalyseAvis |
198 | { |
199 | return $this->avisReferent; |
200 | } |
201 | |
202 | public function setAvisReferent(AnalyseAvis $avisReferent): void |
203 | { |
204 | $this->avisReferent = $avisReferent; |
205 | } |
206 | |
207 | public function getAvisDpd(): AnalyseAvis |
208 | { |
209 | return $this->avisDpd; |
210 | } |
211 | |
212 | public function setAvisDpd(AnalyseAvis $avisDpd): void |
213 | { |
214 | $this->avisDpd = $avisDpd; |
215 | } |
216 | |
217 | public function getAvisRepresentant(): AnalyseAvis |
218 | { |
219 | return $this->avisRepresentant; |
220 | } |
221 | |
222 | public function setAvisRepresentant(AnalyseAvis $avisRepresentant): void |
223 | { |
224 | $this->avisRepresentant = $avisRepresentant; |
225 | } |
226 | |
227 | public function getAvisResponsable(): AnalyseAvis |
228 | { |
229 | return $this->avisResponsable; |
230 | } |
231 | |
232 | public function setAvisResponsable(AnalyseAvis $avisResponsable): void |
233 | { |
234 | $this->avisResponsable = $avisResponsable; |
235 | } |
236 | |
237 | public function isValidated(): bool |
238 | { |
239 | return $this->isValidated; |
240 | } |
241 | |
242 | public function setIsValidated(bool $isValidated): void |
243 | { |
244 | $this->isValidated = $isValidated; |
245 | } |
246 | |
247 | public function setMesureProtections($mesureProtections): void |
248 | { |
249 | $this->mesureProtections = $mesureProtections; |
250 | } |
251 | |
252 | public function getMesureProtections() |
253 | { |
254 | return $this->mesureProtections; |
255 | } |
256 | |
257 | public function getLabelAmeliorationPrevue(): string |
258 | { |
259 | return $this->labelAmeliorationPrevue; |
260 | } |
261 | |
262 | public function setLabelAmeliorationPrevue(string $labelAmeliorationPrevue): void |
263 | { |
264 | $this->labelAmeliorationPrevue = $labelAmeliorationPrevue; |
265 | } |
266 | |
267 | public function getLabelInsatisfaisant(): string |
268 | { |
269 | return $this->labelInsatisfaisant; |
270 | } |
271 | |
272 | public function setLabelInsatisfaisant(string $labelInsatisfaisant): void |
273 | { |
274 | $this->labelInsatisfaisant = $labelInsatisfaisant; |
275 | } |
276 | |
277 | public function getLabelSatisfaisant(): string |
278 | { |
279 | return $this->labelSatisfaisant; |
280 | } |
281 | |
282 | public function setLabelSatisfaisant(string $labelSatisfaisant): void |
283 | { |
284 | $this->labelSatisfaisant = $labelSatisfaisant; |
285 | } |
286 | } |