ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilLanguageSetupConfig.php
Go to the documentation of this file.
1 <?php
2 
3 /* Copyright (c) 2019 Richard Klees <richard.klees@concepts-and-training.de> Extended GPL, see docs/LICENSE */
4 
5 use ILIAS\Setup;
6 
7 class ilLanguageSetupConfig implements Setup\Config
8 {
12  protected $default_language;
13 
17  protected $install_languages;
18 
23 
24  public function __construct(
25  string $default_language,
26  array $install_languages,
28  ) {
29  $this->checkLanguageName($default_language);
30  foreach ($install_languages as $l) {
31  $this->checkLanguageName($l);
32  }
33  foreach ($install_local_languages as $l) {
34  $this->checkLanguageName($l);
35  }
36  if (!in_array($default_language, $install_languages)) {
37  throw new \InvalidArgumentException(
38  "Default language '$default_language' is not in the languages to be installed."
39  );
40  }
41  $diff = array_diff($install_local_languages, $install_languages);
42  if (count($diff) > 0) {
43  throw new \InvalidArgumentException(
44  "Local languages " . implode(", ", $diff) . " are not in the languages to be installed."
45  );
46  }
47  $this->default_language = $default_language;
48  $this->install_languages = array_values($install_languages);
49  $this->install_local_languages = array_values($install_local_languages);
50  }
51 
52  protected function checkLanguageName(string $l) : void
53  {
54  if (!strlen($l) == 2) {
55  throw new \InvalidArgumentException(
56  "'$l' is not a valid language id."
57  );
58  }
59  }
60 
61  public function getDefaultLanguage() : string
62  {
64  }
65 
69  public function getInstallLanguages() : array
70  {
72  }
73 
77  public function getInstallLocalLanguages() : array
78  {
80  }
81 }
__construct(string $default_language, array $install_languages, array $install_local_languages)