| Total Complexity | 8 |
| Total Lines | 59 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 19 | class ConfigLanguageProvider extends BaseObject implements LanguageProviderInterface |
||
| 20 | { |
||
| 21 | /** |
||
| 22 | * Application languages list. |
||
| 23 | * |
||
| 24 | * @var array |
||
| 25 | */ |
||
| 26 | public $languages = []; |
||
| 27 | /** |
||
| 28 | * Default application language. |
||
| 29 | * |
||
| 30 | * @var array |
||
| 31 | */ |
||
| 32 | public $defaultLanguage = []; |
||
| 33 | |||
| 34 | |||
| 35 | /** |
||
| 36 | * Check whether provider config is correct. |
||
| 37 | * |
||
| 38 | * @throws InvalidConfigException |
||
| 39 | */ |
||
| 40 | public function init() |
||
| 41 | { |
||
| 42 | if (empty($this->languages)) { |
||
| 43 | throw new InvalidConfigException("'languages' field cannot be empty"); |
||
| 44 | } |
||
| 45 | if (empty($this->defaultLanguage)) { |
||
| 46 | throw new InvalidConfigException("defaultLanguage' field cannot be empty"); |
||
| 47 | } |
||
| 48 | } |
||
| 49 | |||
| 50 | /** |
||
| 51 | * @inheritdoc |
||
| 52 | */ |
||
| 53 | public function getLanguages() |
||
| 54 | { |
||
| 55 | return $this->languages; |
||
| 56 | } |
||
| 57 | |||
| 58 | /** |
||
| 59 | * @inheritdoc |
||
| 60 | */ |
||
| 61 | public function getDefaultLanguage() |
||
| 62 | { |
||
| 63 | return $this->defaultLanguage; |
||
| 64 | } |
||
| 65 | |||
| 66 | /** |
||
| 67 | * @inheritdoc |
||
| 68 | */ |
||
| 69 | public function getLanguageLabel($locale) |
||
| 78 | } |
||
| 79 | } |
||
| 80 |