35 lines
No EOL
611 B
PHP
Executable file
35 lines
No EOL
611 B
PHP
Executable file
<?php
|
|
/**
|
|
* Singleton configuration class
|
|
* Register configuration directives with this class
|
|
*/
|
|
class Config {
|
|
private static $instance = null;
|
|
|
|
private $config = array();
|
|
|
|
private function __construct() {
|
|
}
|
|
|
|
public static function getInstance() {
|
|
if (self::$instance === null) {
|
|
$clazz = __CLASS__;
|
|
self::$instance = new $clazz();
|
|
}
|
|
return self::$instance;
|
|
}
|
|
|
|
public function register($key, $value) {
|
|
$this->config[$key] = $value;
|
|
return;
|
|
}
|
|
|
|
public function retrieve($key) {
|
|
if (isset($this->config[$key])) {
|
|
return $this->config[$key];
|
|
} else {
|
|
return false;
|
|
}
|
|
}
|
|
}
|
|
?>
|