mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-23 11:26:37 +00:00
Language: use null coalesce for get() and internalGet()
This commit is contained in:
parent
58b46179f9
commit
4e8a256a53
@ -145,13 +145,7 @@ class Language{
|
|||||||
* @return string|null
|
* @return string|null
|
||||||
*/
|
*/
|
||||||
protected function internalGet(string $id){
|
protected function internalGet(string $id){
|
||||||
if(isset($this->lang[$id])){
|
return $this->lang[$id] ?? $this->fallbackLang[$id] ?? null;
|
||||||
return $this->lang[$id];
|
|
||||||
}elseif(isset($this->fallbackLang[$id])){
|
|
||||||
return $this->fallbackLang[$id];
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -160,13 +154,7 @@ class Language{
|
|||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function get(string $id) : string{
|
public function get(string $id) : string{
|
||||||
if(isset($this->lang[$id])){
|
return $this->internalGet($id) ?? $id;
|
||||||
return $this->lang[$id];
|
|
||||||
}elseif(isset($this->fallbackLang[$id])){
|
|
||||||
return $this->fallbackLang[$id];
|
|
||||||
}
|
|
||||||
|
|
||||||
return $id;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user