Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
12.50% |
5 / 40 |
|
5.26% |
1 / 19 |
CRAP | |
0.00% |
0 / 1 |
Reponse | |
12.50% |
5 / 40 |
|
5.26% |
1 / 19 |
443.70 | |
0.00% |
0 / 1 |
__construct | |
100.00% |
5 / 5 |
|
100.00% |
1 / 1 |
1 | |||
getId | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
isConforme | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
setConforme | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getQuestion | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
setQuestion | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getConformiteTraitement | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
setConformiteTraitement | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getActionProtections | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
addActionProtection | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
removeActionProtection | |
0.00% |
0 / 4 |
|
0.00% |
0 / 1 |
6 | |||
getActionProtectionsPlanifiedNotSeens | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
addActionProtectionsPlanifiedNotSeen | |
0.00% |
0 / 4 |
|
0.00% |
0 / 1 |
6 | |||
removeActionProtectionsPlanifiedNotSeen | |
0.00% |
0 / 4 |
|
0.00% |
0 / 1 |
6 | |||
resetActionProtectionsPlanifiedNotSeens | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
__toString | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
6 | |||
getAnalyseQuestionsConformite | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
addAnalyseQuestionConformite | |
0.00% |
0 / 4 |
|
0.00% |
0 / 1 |
6 | |||
removeAnalyseQuestionConformite | |
0.00% |
0 / 4 |
|
0.00% |
0 / 1 |
6 |
1 | <?php |
2 | |
3 | /** |
4 | * This file is part of the MADIS - RGPD Management application. |
5 | * |
6 | * @copyright Copyright (c) 2018-2019 Soluris - Solutions Numériques Territoriales Innovantes |
7 | * |
8 | * This program is free software: you can redistribute it and/or modify |
9 | * it under the terms of the GNU Affero General Public License as published by |
10 | * the Free Software Foundation, either version 3 of the License, or |
11 | * (at your option) any later version. |
12 | * |
13 | * This program is distributed in the hope that it will be useful, |
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 | * GNU Affero General Public License for more details. |
17 | * |
18 | * You should have received a copy of the GNU Affero General Public License |
19 | * along with this program. If not, see <https://www.gnu.org/licenses/>. |
20 | */ |
21 | |
22 | declare(strict_types=1); |
23 | |
24 | namespace App\Domain\Registry\Model\ConformiteTraitement; |
25 | |
26 | use App\Domain\AIPD\Model\AnalyseQuestionConformite; |
27 | use App\Domain\Registry\Model\Mesurement; |
28 | use App\Domain\Reporting\Model\LoggableSubject; |
29 | use Ramsey\Uuid\Uuid; |
30 | use Ramsey\Uuid\UuidInterface; |
31 | |
32 | class Reponse implements LoggableSubject |
33 | { |
34 | /** |
35 | * @var UuidInterface |
36 | */ |
37 | private $id; |
38 | |
39 | /** |
40 | * @var bool |
41 | */ |
42 | private $conforme; |
43 | |
44 | /** |
45 | * @var Question |
46 | */ |
47 | private $question; |
48 | |
49 | /** |
50 | * @var ConformiteTraitement |
51 | */ |
52 | private $conformiteTraitement; |
53 | |
54 | /** |
55 | * @var iterable |
56 | */ |
57 | private $actionProtections; |
58 | |
59 | /** |
60 | * Ici on stock les actions de protections liées à la réponse qui viennent de passer à l'état planifiée. |
61 | * Tant que l'utilisateur n'a pas de nouveau update (via un POST) la conformité de traitement liée alors on affiche |
62 | * la notification sur la ligne de la conformité de traitement (vue liste) et sur la réponse (vue édit). |
63 | * Lors de la sauvegarde de la conformité de traitement, les actions de protections non vues sont remises à zéro car |
64 | * elles ont été vues par l'utilisateur. |
65 | * |
66 | * @var iterable |
67 | */ |
68 | private $actionProtectionsPlanifiedNotSeens; |
69 | |
70 | /** |
71 | * @var iterable |
72 | */ |
73 | private $analyseQuestionsConformites; |
74 | |
75 | public function __construct() |
76 | { |
77 | $this->id = Uuid::uuid4(); |
78 | $this->conforme = false; |
79 | $this->actionProtections = []; |
80 | $this->actionProtectionsPlanifiedNotSeens = []; |
81 | $this->analyseQuestionsConformites = []; |
82 | } |
83 | |
84 | public function getId(): UuidInterface |
85 | { |
86 | return $this->id; |
87 | } |
88 | |
89 | public function isConforme(): bool |
90 | { |
91 | return $this->conforme; |
92 | } |
93 | |
94 | public function setConforme(bool $conforme): void |
95 | { |
96 | $this->conforme = $conforme; |
97 | } |
98 | |
99 | public function getQuestion(): Question |
100 | { |
101 | return $this->question; |
102 | } |
103 | |
104 | public function setQuestion(Question $question): void |
105 | { |
106 | $this->question = $question; |
107 | } |
108 | |
109 | public function getConformiteTraitement(): ConformiteTraitement |
110 | { |
111 | return $this->conformiteTraitement; |
112 | } |
113 | |
114 | public function setConformiteTraitement(ConformiteTraitement $conformiteTraitement): void |
115 | { |
116 | $this->conformiteTraitement = $conformiteTraitement; |
117 | } |
118 | |
119 | public function getActionProtections() |
120 | { |
121 | return $this->actionProtections; |
122 | } |
123 | |
124 | public function addActionProtection(Mesurement $mesurement): void |
125 | { |
126 | $this->actionProtections[] = $mesurement; |
127 | } |
128 | |
129 | public function removeActionProtection(Mesurement $mesurement): void |
130 | { |
131 | $key = \array_search($mesurement, \iterable_to_array($this->actionProtections), true); |
132 | |
133 | if (false === $key) { |
134 | return; |
135 | } |
136 | |
137 | unset($this->actionProtections[$key]); |
138 | } |
139 | |
140 | public function getActionProtectionsPlanifiedNotSeens(): iterable |
141 | { |
142 | return $this->actionProtectionsPlanifiedNotSeens; |
143 | } |
144 | |
145 | public function addActionProtectionsPlanifiedNotSeen(Mesurement $mesurement): void |
146 | { |
147 | $key = \array_search($mesurement, \iterable_to_array($this->actionProtectionsPlanifiedNotSeens), true); |
148 | |
149 | if (false !== $key) { |
150 | return; |
151 | } |
152 | |
153 | $this->actionProtectionsPlanifiedNotSeens[] = $mesurement; |
154 | } |
155 | |
156 | public function removeActionProtectionsPlanifiedNotSeen(Mesurement $mesurement): void |
157 | { |
158 | $key = \array_search($mesurement, \iterable_to_array($this->actionProtectionsPlanifiedNotSeens), true); |
159 | |
160 | if (false === $key) { |
161 | return; |
162 | } |
163 | |
164 | unset($this->actionProtectionsPlanifiedNotSeens[$key]); |
165 | } |
166 | |
167 | public function resetActionProtectionsPlanifiedNotSeens(): void |
168 | { |
169 | $this->actionProtectionsPlanifiedNotSeens = []; |
170 | } |
171 | |
172 | public function __toString(): string |
173 | { |
174 | if ($this->question) { |
175 | return 'Reponse .' . $this->question->getQuestion(); |
176 | } |
177 | |
178 | return 'Reponse ???'; |
179 | } |
180 | |
181 | public function getAnalyseQuestionsConformite(): iterable |
182 | { |
183 | return $this->analyseQuestionsConformites; |
184 | } |
185 | |
186 | public function addAnalyseQuestionConformite(AnalyseQuestionConformite $questionConformite): void |
187 | { |
188 | $key = \array_search($questionConformite, \iterable_to_array($this->analyseQuestionsConformites), true); |
189 | |
190 | if (false !== $key) { |
191 | return; |
192 | } |
193 | |
194 | $this->analyseQuestionsConformites[] = $questionConformite; |
195 | } |
196 | |
197 | public function removeAnalyseQuestionConformite(AnalyseQuestionConformite $questionConformite): void |
198 | { |
199 | $key = \array_search($questionConformite, \iterable_to_array($this->analyseQuestionsConformites), true); |
200 | |
201 | if (false === $key) { |
202 | return; |
203 | } |
204 | |
205 | unset($this->analyseQuestionsConformites[$key]); |
206 | } |
207 | } |