Added float support to config

This commit is contained in:
Matthew Barbour 2019-06-15 11:03:09 -05:00 committed by matthew
parent 0202597f88
commit 4ade0090cc

View file

@ -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);