| Conditions | 2 |
| Paths | 2 |
| Total Lines | 12 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 6 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 22 | private function validate(string $code): string |
||
| 23 | { |
||
| 24 | $code = mb_strtoupper(trim($code)); |
||
| 25 | $validatedCode = ''; |
||
|
|
|||
| 26 | |||
| 27 | try { |
||
| 28 | $validatedCode = constant('\CodeblogPro\GeoLocation\Application\Enums\AvailableLanguages::' . $code); |
||
| 29 | } catch (\Exception $exception) { |
||
| 30 | throw new IncorrectLanguageCodeException(); |
||
| 31 | } |
||
| 32 | |||
| 33 | return $validatedCode; |
||
| 34 | } |
||
| 36 |