diff --git a/lib/Configuration.php b/lib/Configuration.php index 3013443b..ddaaa051 100644 --- a/lib/Configuration.php +++ b/lib/Configuration.php @@ -220,9 +220,9 @@ final class Configuration } } - public static function getConfig(string $section, string $key) + public static function getConfig(string $section, string $key, $default = null) { - return self::$config[strtolower($section)][strtolower($key)] ?? null; + return self::$config[strtolower($section)][strtolower($key)] ?? $default; } private static function setConfig(string $section, string $key, $value): void diff --git a/tests/ConfigurationTest.php b/tests/ConfigurationTest.php index 4dcbfb8b..c2eca95c 100644 --- a/tests/ConfigurationTest.php +++ b/tests/ConfigurationTest.php @@ -14,6 +14,7 @@ final class ConfigurationTest extends TestCase Configuration::loadConfiguration(); $this->assertSame(null, Configuration::getConfig('foobar', '')); $this->assertSame(null, Configuration::getConfig('foo', 'bar')); + $this->assertSame('baz', Configuration::getConfig('foo', 'bar', 'baz')); $this->assertSame(null, Configuration::getConfig('cache', '')); $this->assertSame('UTC', Configuration::getConfig('system', 'timezone')); }