drop un-used, un-tested config variants

This commit is contained in:
Shish 2020-02-01 21:40:35 +00:00
parent 6f7e0e5b12
commit 665d5db3f6

View file

@ -241,59 +241,6 @@ abstract class BaseConfig implements Config
}
/**
* Class HardcodeConfig
*
* For testing, mostly.
*/
class HardcodeConfig extends BaseConfig
{
public function __construct(array $dict)
{
$this->values = $dict;
}
public function save(string $name=null): void
{
// static config is static
}
}
/**
* Class StaticConfig
*
* Loads the config list from a PHP file; the file should be in the format:
*
* <?php
* $config['foo'] = "bar";
* $config['baz'] = "qux";
* ?>
*/
class StaticConfig extends BaseConfig
{
public function __construct(string $filename)
{
if (file_exists($filename)) {
$config = [];
require_once $filename;
if (!empty($config)) {
$this->values = $config;
} else {
throw new ScoreException("Config file '$filename' doesn't contain any config");
}
} else {
throw new ScoreException("Config file '$filename' missing");
}
}
public function save(string $name=null): void
{
// static config is static
}
}
/**
* Class DatabaseConfig
*
@ -389,16 +336,3 @@ class DatabaseConfig extends BaseConfig
$cache->set("config", $this->values);
}
}
/**
* Class MockConfig
*/
class MockConfig extends HardcodeConfig
{
public function __construct(array $config=[])
{
$config["db_version"] = "999";
$config["anon_id"] = "0";
parent::__construct($config);
}
}