getLanguage() публичный статический Метод

Return the two-letter language code from STDIN
public static getLanguage ( array $langs ) : string
$langs array
Результат string
Пример #1
0
 foreach ($langs as $key => $value) {
     $num = $i < 10 ? ' ' . $i : $i;
     $langsList .= '  ' . $num . ' : [' . $key . '] ' . $value . PHP_EOL;
     $i++;
 }
 // Prompt user to select language
 if (isset($argv[2])) {
     if (!array_key_exists($argv[2], $langs)) {
         echo $langsList . PHP_EOL;
         $lang = Install::getLanguage($langs);
     } else {
         $lang = $argv[2];
     }
 } else {
     echo $langsList . PHP_EOL;
     $lang = Install::getLanguage($langs);
 }
 $keys = array_keys($langs);
 echo 'You selected [' . $keys[$lang] . '] : ' . $langs[$keys[$lang]] . PHP_EOL . PHP_EOL;
 // Get the bootstrap file
 $location = Install::getBootstrap();
 $bootstrap = new File($location . '/bootstrap.php');
 $bootstrapCode = $bootstrap->read();
 // Set the new default language setting into the bootstrap file
 if (stripos($bootstrapCode, 'define(\'POP_LANG') !== false) {
     $curLangCode = substr($bootstrapCode, stripos($bootstrapCode, 'define(\'POP_LANG'));
     $curLangCode = substr($curLangCode, 0, strpos($curLangCode, ';'));
     $bootstrapCode = str_replace($curLangCode, 'define(\'POP_LANG\', \'' . $keys[$lang] . '\')', $bootstrapCode);
 } else {
     $curLangCode = substr($bootstrapCode, stripos($bootstrapCode, 'require_once'));
     $curLangCode = substr($curLangCode, 0, strpos($curLangCode, ';'));