public function __construct($filename = null)
{
if (is_null($filename) || !file_exists($filename)) {
$filename = $this->searchConfigFile();
}
if (is_null($filename)) {
throw new DbPatch_Exception('No config file found');
}
$type = $this->detectConfigType($filename);
switch ($type) {
case 'php':
$this->config = $this->loadPhpConfig($filename, 'dbpatch', false);
break;
case 'ini':
$this->config = $this->loadIniConfig($filename, 'dbpatch', true);
break;
case 'xml':
$this->config = $this->loadXmlConfig($filename, 'dbpatch', true);
break;
default:
throw new DbPatch_Exception('Not a valid config file');
}
}