mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-04 08:56:15 +00:00
Isolate config casting nastiness in one place
this doesn't solve the underlying problem, but it does reduce the amount of noise made by PHPStan about it, as well as avoiding code litter.
This commit is contained in:
@ -65,6 +65,18 @@ final class ServerConfigGroup{
|
||||
return $this->propertyCache[$variable] ?? $defaultValue;
|
||||
}
|
||||
|
||||
public function getPropertyBool(string $variable, bool $defaultValue) : bool{
|
||||
return (bool) $this->getProperty($variable, $defaultValue);
|
||||
}
|
||||
|
||||
public function getPropertyInt(string $variable, int $defaultValue) : int{
|
||||
return (int) $this->getProperty($variable, $defaultValue);
|
||||
}
|
||||
|
||||
public function getPropertyString(string $variable, string $defaultValue) : string{
|
||||
return (string) $this->getProperty($variable, $defaultValue);
|
||||
}
|
||||
|
||||
public function getConfigString(string $variable, string $defaultValue = "") : string{
|
||||
$v = getopt("", ["$variable::"]);
|
||||
if(isset($v[$variable])){
|
||||
|
Reference in New Issue
Block a user