Added float support to config
This commit is contained in:
parent
0202597f88
commit
4ade0090cc
1 changed files with 12 additions and 0 deletions
|
@ -144,6 +144,13 @@ abstract class BaseConfig implements Config
|
|||
}
|
||||
}
|
||||
|
||||
public function set_default_float(string $name, float $value): void
|
||||
{
|
||||
if (is_null($this->get($name))) {
|
||||
$this->values[$name] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
public function set_default_string(string $name, string $value): void
|
||||
{
|
||||
if (is_null($this->get($name))) {
|
||||
|
@ -170,6 +177,11 @@ abstract class BaseConfig implements Config
|
|||
return (int)($this->get($name, $default));
|
||||
}
|
||||
|
||||
public function get_float(string $name, ?float $default=null): ?float
|
||||
{
|
||||
return (float)($this->get($name, $default));
|
||||
}
|
||||
|
||||
public function get_string(string $name, ?string $default=null): ?string
|
||||
{
|
||||
return $this->get($name, $default);
|
||||
|
|
Reference in a new issue