mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-20 11:39:43 +00:00
Fix #971. Add lowercase checking of Config.
This commit is contained in:
parent
e2298d861c
commit
01e9ca7852
2 changed files with 33 additions and 8 deletions
|
|
@ -181,9 +181,21 @@ class Config{
|
|||
public function setAll($v){
|
||||
$this->config = $v;
|
||||
}
|
||||
|
||||
public function exists($k){
|
||||
return isset($this->config[$k]);
|
||||
|
||||
/**
|
||||
* @param mixed $k
|
||||
* @param bool $lowercase If set, searches Config in single-case / lowercase.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function exists($k, $lowercase = false){
|
||||
if($lowercase === true)://Take this ridiculously retarded IF formatting! - @sekjun98888877777778888888888888
|
||||
$k = strtolower($k);//Convert requested key to lower
|
||||
$array = array_change_key_case($this->config, CASE_LOWER);//Change all keys in array to lower
|
||||
return isset($array[$k]);//Find $k in modified array
|
||||
else:
|
||||
return isset($this->config[$k]);
|
||||
endif;
|
||||
}
|
||||
|
||||
public function remove($k){
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue