mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-03-14 20:21:14 +03:00
feat: add default arg to Configuration::getConfig (#3331)
This commit is contained in:
parent
cf920694d5
commit
a21d496bc7
2 changed files with 3 additions and 2 deletions
|
@ -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
|
||||
|
|
|
@ -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'));
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue