Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 27 |
|
0.00% |
0 / 23 |
CRAP | |
0.00% |
0 / 1 |
Service | |
0.00% |
0 / 27 |
|
0.00% |
0 / 23 |
650 | |
0.00% |
0 / 1 |
__construct | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getId | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
__toString | |
0.00% |
0 / 5 |
|
0.00% |
0 / 1 |
12 | |||
getName | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
setName | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getUsers | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
setUsers | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getCollectivity | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
setCollectivity | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getTreatments | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
setTreatments | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getContractors | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
setContractors | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getRequests | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
setRequests | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getViolations | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
setViolations | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getProofs | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
setProofs | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getTools | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
setTools | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getMesurements | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
setMesurements | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 |
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\User\Model; |
25 | |
26 | use App\Application\Traits\Model\CollectivityTrait; |
27 | use App\Application\Traits\Model\HistoryTrait; |
28 | use App\Domain\Registry\Model\Contractor; |
29 | use App\Domain\Registry\Model\Mesurement; |
30 | use App\Domain\Registry\Model\Proof; |
31 | use App\Domain\Registry\Model\Request; |
32 | use App\Domain\Registry\Model\Tool; |
33 | use App\Domain\Registry\Model\Treatment; |
34 | use App\Domain\Registry\Model\Violation; |
35 | use App\Domain\Reporting\Model\LoggableSubject; |
36 | use Ramsey\Uuid\Uuid; |
37 | use Ramsey\Uuid\UuidInterface; |
38 | |
39 | class Service implements LoggableSubject |
40 | { |
41 | use CollectivityTrait; |
42 | use HistoryTrait; |
43 | |
44 | /** |
45 | * @var UuidInterface |
46 | */ |
47 | private $id; |
48 | |
49 | /** |
50 | * @var string|null |
51 | */ |
52 | private $name; |
53 | |
54 | /** |
55 | * @var User[] |
56 | */ |
57 | private $users; |
58 | |
59 | /** |
60 | * @var Collectivity |
61 | */ |
62 | private $collectivity; |
63 | |
64 | /** |
65 | * @var Treatment[] |
66 | */ |
67 | private $treatments; |
68 | |
69 | /** |
70 | * @var Contractor[] |
71 | */ |
72 | private $contractors; |
73 | |
74 | /** |
75 | * @var Request[] |
76 | */ |
77 | private $requests; |
78 | |
79 | /** |
80 | * @var Violation[] |
81 | */ |
82 | private $violations; |
83 | |
84 | /** |
85 | * @var Proof[] |
86 | */ |
87 | private $proofs; |
88 | |
89 | /** |
90 | * @var Tool[] |
91 | */ |
92 | private $tools; |
93 | |
94 | /** |
95 | * @var Mesurement[] |
96 | */ |
97 | private $mesurements; |
98 | |
99 | public function __construct() |
100 | { |
101 | $this->id = Uuid::uuid4(); |
102 | } |
103 | |
104 | public function getId(): UuidInterface |
105 | { |
106 | return $this->id; |
107 | } |
108 | |
109 | public function __toString(): string |
110 | { |
111 | if (\is_null($this->getName())) { |
112 | return ''; |
113 | } |
114 | |
115 | if (\mb_strlen($this->getName()) > 150) { |
116 | return \mb_substr($this->getName(), 0, 150) . '...'; |
117 | } |
118 | |
119 | return $this->getName(); |
120 | } |
121 | |
122 | public function getName(): ?string |
123 | { |
124 | return $this->name; |
125 | } |
126 | |
127 | public function setName(?string $name): void |
128 | { |
129 | $this->name = $name; |
130 | } |
131 | |
132 | public function getUsers() |
133 | { |
134 | return $this->users; |
135 | } |
136 | |
137 | public function setUsers($users): void |
138 | { |
139 | $this->users = $users; |
140 | } |
141 | |
142 | public function getCollectivity(): Collectivity |
143 | { |
144 | return $this->collectivity; |
145 | } |
146 | |
147 | public function setCollectivity(Collectivity $collectivity): void |
148 | { |
149 | $this->collectivity = $collectivity; |
150 | } |
151 | |
152 | public function getTreatments() |
153 | { |
154 | return $this->treatments; |
155 | } |
156 | |
157 | public function setTreatments($treatments): void |
158 | { |
159 | $this->treatments = $treatments; |
160 | } |
161 | |
162 | public function getContractors() |
163 | { |
164 | return $this->contractors; |
165 | } |
166 | |
167 | public function setContractors($contractors): void |
168 | { |
169 | $this->contractors = $contractors; |
170 | } |
171 | |
172 | public function getRequests() |
173 | { |
174 | return $this->requests; |
175 | } |
176 | |
177 | public function setRequests($requests): void |
178 | { |
179 | $this->requests = $requests; |
180 | } |
181 | |
182 | public function getViolations() |
183 | { |
184 | return $this->violations; |
185 | } |
186 | |
187 | public function setViolations($violations): void |
188 | { |
189 | $this->violations = $violations; |
190 | } |
191 | |
192 | /** |
193 | * @return Proof[] |
194 | */ |
195 | public function getProofs(): array |
196 | { |
197 | return $this->proofs; |
198 | } |
199 | |
200 | /** |
201 | * @param Proof[] $proofs |
202 | */ |
203 | public function setProofs(array $proofs): void |
204 | { |
205 | $this->proofs = $proofs; |
206 | } |
207 | |
208 | /** |
209 | * @return Tool[] |
210 | */ |
211 | public function getTools(): array |
212 | { |
213 | return $this->tools; |
214 | } |
215 | |
216 | /** |
217 | * @param Tool[] $tools |
218 | */ |
219 | public function setTools(array $tools): void |
220 | { |
221 | $this->tools = $tools; |
222 | } |
223 | |
224 | /** |
225 | * @return Mesurement[] |
226 | */ |
227 | public function getMesurements(): array |
228 | { |
229 | return $this->mesurements; |
230 | } |
231 | |
232 | /** |
233 | * @param Mesurement[] $mesurements |
234 | */ |
235 | public function setMesurements(array $mesurements): void |
236 | { |
237 | $this->mesurements = $mesurements; |
238 | } |
239 | } |