Fix all classes with PHP-DOC style method comments

Also various fixes for clean phan run
Update config base for array type host settings and no long single
entries
This commit is contained in:
Clemens Schwaighofer
2019-09-19 11:56:27 +09:00
parent 9ea8364aab
commit bf96eb755d
20 changed files with 2067 additions and 2109 deletions

View File

@@ -35,6 +35,12 @@ class L10n extends \CoreLibs\Basic
private $input;
private $l10n;
/**
* class constructor call for language getstring
* @param string $lang language name (optional), fallback is en
* @param string $path path, if empty fallback on default internal path
* @param int|integer $set_control_flag control flags for Basic class set/get checks
*/
public function __construct(string $lang = '', string $path = '', int $set_control_flag = 0)
{
parent::__construct($set_control_flag);
@@ -60,7 +66,12 @@ class L10n extends \CoreLibs\Basic
$this->l10n = new GetTextReader($this->input);
}
// reloads the mofile, if the location of the lang file changes
/**
* reloads the mofile, if the location of the lang file changes
* @param string $lang language to reload data
* @param string $path optional path, if not set fallback on internal
* @return bool successfull reload true/false
*/
public function l10nReloadMOfile(string $lang, string $path = ''): bool
{
$success = false;
@@ -90,27 +101,52 @@ class L10n extends \CoreLibs\Basic
return $success;
}
public function __($text)
/**
* translates a string and returns translated text
* @param string $text text to translate
* @return string translated text
*/
public function __($text): string
{
return $this->l10n->translate($text);
}
public function __e($text)
/**
* prints translated string out to the screen
* @param string $text text to translate
* @return void has no return
*/
public function __e($text): void
{
echo $this->l10n->translate($text);
}
// Return the plural form.
/**
* Return the plural form.
* @param string $single string for single word
* @param string $plural string for plural word
* @param string $number number value
* @return string translated plural string
*/
public function __ngettext($single, $plural, $number)
{
return $this->l10n->ngettext($single, $plural, $number);
}
/**
* get current set language
* @return string current set language string
*/
public function __getLang()
{
return $this->lang;
}
/**
* get current set mo file
* @return string current set mo language file
*/
public function __getMoFile()
{
return $this->mofile;