Added float support to config
This commit is contained in:
parent
0202597f88
commit
4ade0090cc
@ -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
|
public function set_default_string(string $name, string $value): void
|
||||||
{
|
{
|
||||||
if (is_null($this->get($name))) {
|
if (is_null($this->get($name))) {
|
||||||
@ -170,6 +177,11 @@ abstract class BaseConfig implements Config
|
|||||||
return (int)($this->get($name, $default));
|
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
|
public function get_string(string $name, ?string $default=null): ?string
|
||||||
{
|
{
|
||||||
return $this->get($name, $default);
|
return $this->get($name, $default);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user