Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
91.30% |
21 / 23 |
|
60.00% |
3 / 5 |
CRAP | |
0.00% |
0 / 1 |
LogJournalSubjectDictionary | |
91.30% |
21 / 23 |
|
60.00% |
3 / 5 |
7.03 | |
0.00% |
0 / 1 |
__construct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
getSubjects | |
100.00% |
19 / 19 |
|
100.00% |
1 / 1 |
1 | |||
getSubjectsKeys | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getSubjectFromClassName | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
2 | |||
getSubjectLabelFromSubjectType | |
0.00% |
0 / 1 |
|
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\Reporting\Dictionary; |
25 | |
26 | use App\Application\Dictionary\SimpleDictionary; |
27 | use App\Domain\Admin\Model\Duplication; |
28 | use App\Domain\Maturity\Model\Survey; |
29 | use App\Domain\Registry\Model\ConformiteOrganisation\Evaluation; |
30 | use App\Domain\Registry\Model\ConformiteTraitement\ConformiteTraitement; |
31 | use App\Domain\Registry\Model\Contractor; |
32 | use App\Domain\Registry\Model\Mesurement; |
33 | use App\Domain\Registry\Model\Proof; |
34 | use App\Domain\Registry\Model\Request; |
35 | use App\Domain\Registry\Model\Treatment; |
36 | use App\Domain\Registry\Model\Violation; |
37 | use App\Domain\User\Model\Collectivity; |
38 | use App\Domain\User\Model\Service; |
39 | use App\Domain\User\Model\User; |
40 | |
41 | class LogJournalSubjectDictionary extends SimpleDictionary |
42 | { |
43 | public const ADMIN_DUPLICATION = 'admin_duplication'; |
44 | public const MATURITY_SURVEY = 'maturity_survey'; |
45 | public const REGISTRY_CONFORMITE_ORGANISATION_EVALUATION = 'registry_conformite_organisation_evaluation'; |
46 | public const REGISTRY_CONFORMITE_TRAITEMENT = 'registry_conformite_traitement'; |
47 | public const REGISTRY_CONTRACTOR = 'registry_contractor'; |
48 | public const REGISTRY_MESUREMENT = 'registry_mesurement'; |
49 | public const REGISTRY_PROOF = 'registry_proof'; |
50 | public const REGISTRY_REQUEST = 'registry_request'; |
51 | public const REGISTRY_TREATMENT = 'registry_treatment'; |
52 | public const USER_COLLECTIVITY = 'user_collectivity'; |
53 | public const USER_EMAIL = 'user_email'; |
54 | public const USER_FIRSTNAME = 'user_firstname'; |
55 | public const USER_LASTNAME = 'user_lastname'; |
56 | public const USER_PASSWORD = 'user_password'; |
57 | public const USER_USER = 'user_user'; |
58 | public const REGISTRY_VIOLATION = 'registry_violation'; |
59 | public const USER_SERVICE = 'user_service'; |
60 | |
61 | public const CLASS_NAME_SUBJECT = [ |
62 | Duplication::class => self::ADMIN_DUPLICATION, |
63 | Survey::class => self::MATURITY_SURVEY, |
64 | Collectivity::class => self::USER_COLLECTIVITY, |
65 | Evaluation::class => self::REGISTRY_CONFORMITE_ORGANISATION_EVALUATION, |
66 | ConformiteTraitement::class => self::REGISTRY_CONFORMITE_TRAITEMENT, |
67 | Contractor::class => self::REGISTRY_CONTRACTOR, |
68 | Mesurement::class => self::REGISTRY_MESUREMENT, |
69 | Proof::class => self::REGISTRY_PROOF, |
70 | Request::class => self::REGISTRY_REQUEST, |
71 | Treatment::class => self::REGISTRY_TREATMENT, |
72 | User::class => self::USER_USER, |
73 | Violation::class => self::REGISTRY_VIOLATION, |
74 | Service::class => self::USER_SERVICE, |
75 | ]; |
76 | |
77 | public function __construct() |
78 | { |
79 | parent::__construct('reporting_log_journal_subject', self::getSubjects()); |
80 | } |
81 | |
82 | /** |
83 | * @return array |
84 | */ |
85 | public static function getSubjects() |
86 | { |
87 | return [ |
88 | self::REGISTRY_TREATMENT => 'Traitement', |
89 | self::REGISTRY_CONTRACTOR => 'Sous-traitant', |
90 | self::REGISTRY_REQUEST => 'Demande', |
91 | self::REGISTRY_VIOLATION => 'Violation', |
92 | self::REGISTRY_PROOF => 'Preuve', |
93 | self::REGISTRY_MESUREMENT => 'Action de protection', |
94 | self::MATURITY_SURVEY => 'Indice de maturité', |
95 | self::REGISTRY_CONFORMITE_TRAITEMENT => 'Conformité traitement', |
96 | self::REGISTRY_CONFORMITE_ORGANISATION_EVALUATION => 'Conformité de la structure', |
97 | self::USER_USER => 'Utilisateur', |
98 | self::USER_FIRSTNAME => 'Prénom utilisateur', |
99 | self::USER_LASTNAME => 'Nom utilisateur', |
100 | self::USER_EMAIL => 'Email utilisateur', |
101 | self::USER_PASSWORD => 'Mot de passe utilisateur', |
102 | self::USER_SERVICE => 'Service', |
103 | self::USER_COLLECTIVITY => 'Structure', |
104 | self::ADMIN_DUPLICATION => 'Duplication', |
105 | ]; |
106 | } |
107 | |
108 | /** |
109 | * @return array |
110 | */ |
111 | public static function getSubjectsKeys() |
112 | { |
113 | return \array_keys(self::getSubjects()); |
114 | } |
115 | |
116 | public static function getSubjectFromClassName(string $className): string |
117 | { |
118 | return array_key_exists($className, self::CLASS_NAME_SUBJECT) ? self::CLASS_NAME_SUBJECT[$className] : ''; |
119 | } |
120 | |
121 | public static function getSubjectLabelFromSubjectType(string $subjectKey): string |
122 | { |
123 | return array_key_exists($subjectKey, self::getSubjects()) ? self::getSubjects()[$subjectKey] : ''; |
124 | } |
125 | } |