pocketmine\utils\Config::exists PHP Method

exists() public method

public exists ( $k, boolean $lowercase = false ) : boolean
$k
$lowercase boolean If set, searches Config in single-case / lowercase.
return boolean
    public function exists($k, $lowercase = false)
    {
        if ($lowercase === true) {
            $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]);
        }
    }

Usage Example

 public function touchIP($ip)
 {
     if (!$this->ipList->exists($ip)) {
         $this->ipList->set($ip);
         return false;
     }
     return true;
 }
All Usage Examples Of pocketmine\utils\Config::exists