Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
63.64% |
7 / 11 |
|
66.67% |
2 / 3 |
CRAP | |
0.00% |
0 / 1 |
ReponseCritereFondamentalDictionary | |
63.64% |
7 / 11 |
|
66.67% |
2 / 3 |
7.73 | |
0.00% |
0 / 1 |
__construct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
getReponses | |
100.00% |
6 / 6 |
|
100.00% |
1 / 1 |
1 | |||
getLabelReponse | |
0.00% |
0 / 4 |
|
0.00% |
0 / 1 |
20 |
1 | <?php |
2 | |
3 | declare(strict_types=1); |
4 | |
5 | namespace App\Domain\AIPD\Dictionary; |
6 | |
7 | use App\Application\Dictionary\SimpleDictionary; |
8 | use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; |
9 | |
10 | class ReponseCritereFondamentalDictionary extends SimpleDictionary |
11 | { |
12 | public const REPONSE_NON_RENSEIGNE = 'non_renseigne'; |
13 | public const REPONSE_NON_CONFORME = 'non_conforme'; |
14 | public const REPONSE_CONFORME = 'conforme'; |
15 | public const REPONSE_NON_APPLICABLE = 'non_applicable'; |
16 | |
17 | public function __construct() |
18 | { |
19 | parent::__construct('reponse_critere_fondamental', self::getReponses()); |
20 | } |
21 | |
22 | public static function getReponses() |
23 | { |
24 | return [ |
25 | self::REPONSE_NON_RENSEIGNE => 'Non renseigné', |
26 | self::REPONSE_NON_CONFORME => 'Non conforme', |
27 | self::REPONSE_CONFORME => 'Conforme', |
28 | self::REPONSE_NON_APPLICABLE => 'Non applicable', |
29 | ]; |
30 | } |
31 | |
32 | public static function getLabelReponse(string $key): string |
33 | { |
34 | if (!array_key_exists($key, self::getReponses())) { |
35 | throw new NotFoundHttpException('Key ' . $key . ' not found in ReponseCritereFondamentalDictionary'); |
36 | } |
37 | |
38 | switch ($key) { |
39 | case self::REPONSE_NON_RENSEIGNE: |
40 | return 'Pas de réponse'; |
41 | default: |
42 | return self::getReponses()[$key]; |
43 | } |
44 | } |
45 | } |