Created this little config class, any room for improvements? Think I have done an alright job but would like to know if any improovements could be made?
<?php
defined("SECURE") or exit('Please define SECURE keyword to continue.');
class config
{
private $configValues;
private $configFile;
public function __construct()
{
$configValues = array();
}
public function loadConfiguration($configFile = "C:\Users\ashle\Miracle\config\config.ini")
{
if (!file_exists($configFile))
loadDefault();
$content = file($configFile);
foreach ($content as $line)
$this->setConfig(explode("=", $line)[0], explode("=", $line)[1]);
}
private function loadDefault()
{
/* DEFAULT CONFIG SETTINGS!!
THIS SHOULD NOT BE THE CASE... */
setConfig("database.host", "localhost");
setConfig("database.username", "root");
setConfig("database.password", "");
setConfig("database.title", "mydb");
setConfig("database.port", "3306");
}
private function setConfig($name, $value)
{
$this->configVlaues[$name] = $value;
}
public function getConfig($name)
{
return $this->configValues[$name];
}
}
?>