Total Complexity | 12 |
Total Lines | 43 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 2 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
15 | class Support |
||
16 | { |
||
17 | public const LANG_KEY = 'lang'; |
||
18 | |||
19 | /** |
||
20 | * @param ArrayAccess<string, mixed> $array |
||
21 | * @param string|null $defaultLang |
||
22 | * @return string|null |
||
23 | */ |
||
24 | 1 | public static function fillFromArray(ArrayAccess $array, ?string $defaultLang): ?string |
|
25 | { |
||
26 | 1 | return $array->offsetExists(static::LANG_KEY) |
|
27 | 1 | && !empty($array->offsetGet(static::LANG_KEY)) |
|
28 | 1 | && is_string($array->offsetGet(static::LANG_KEY)) |
|
29 | 1 | ? $array->offsetGet(static::LANG_KEY) |
|
30 | 1 | : $defaultLang ; |
|
31 | } |
||
32 | |||
33 | /** |
||
34 | * @param ArrayAccess<string, string> $array |
||
35 | * @param string $lang |
||
36 | */ |
||
37 | 1 | public static function setToArray(ArrayAccess $array, string $lang): void |
|
40 | 1 | } |
|
41 | |||
42 | 6 | public static function fillFromPaths(RoutedPath $path, string $defaultLang, bool $moreLangs): string |
|
60 |