Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
42.11% |
8 / 19 |
|
75.00% |
3 / 4 |
CRAP | |
0.00% |
0 / 1 |
DuplicationTypeDictionary | |
42.11% |
8 / 19 |
|
75.00% |
3 / 4 |
24.72 | |
0.00% |
0 / 1 |
__construct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
getData | |
100.00% |
6 / 6 |
|
100.00% |
1 / 1 |
1 | |||
getDataKeys | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
getClassName | |
0.00% |
0 / 11 |
|
0.00% |
0 / 1 |
42 |
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\Admin\Dictionary; |
25 | |
26 | use App\Application\Dictionary\SimpleDictionary; |
27 | use App\Domain\Registry\Model\Contractor; |
28 | use App\Domain\Registry\Model\Mesurement; |
29 | use App\Domain\Registry\Model\Tool; |
30 | use App\Domain\Registry\Model\Treatment; |
31 | |
32 | class DuplicationTypeDictionary extends SimpleDictionary |
33 | { |
34 | public const NAME = 'admin_duplication_type'; |
35 | |
36 | public const KEY_TREATMENT = 'treatment'; |
37 | public const KEY_CONTRACTOR = 'contractor'; |
38 | public const KEY_MESUREMENT = 'mesurement'; |
39 | public const KEY_TOOL = 'tool'; |
40 | |
41 | public function __construct() |
42 | { |
43 | parent::__construct(self::NAME, self::getData()); |
44 | } |
45 | |
46 | /** |
47 | * Get an array of data. |
48 | * |
49 | * @return array |
50 | */ |
51 | public static function getData() |
52 | { |
53 | return [ |
54 | self::KEY_TREATMENT => 'Traitement', |
55 | self::KEY_CONTRACTOR => 'Sous-traitant', |
56 | self::KEY_TOOL => 'Logiciel et support', |
57 | self::KEY_MESUREMENT => 'Action de protection', |
58 | ]; |
59 | } |
60 | |
61 | /** |
62 | * Get keys of the data array. |
63 | * |
64 | * @return array |
65 | */ |
66 | public static function getDataKeys() |
67 | { |
68 | return \array_keys(self::getData()); |
69 | } |
70 | |
71 | public static function getClassName(string $key) |
72 | { |
73 | $className = ''; |
74 | switch ($key) { |
75 | case self::KEY_TREATMENT: |
76 | $className = Treatment::class; |
77 | break; |
78 | case self::KEY_CONTRACTOR: |
79 | $className = Contractor::class; |
80 | break; |
81 | case self::KEY_MESUREMENT: |
82 | $className = Mesurement::class; |
83 | break; |
84 | case self::KEY_TOOL: |
85 | $className = Tool::class; |
86 | break; |
87 | default: |
88 | break; |
89 | } |
90 | |
91 | return $className; |
92 | } |
93 | } |