Removed the Singleton class, removed the ImageUtils class (for now) and switched the DB class to be an instantiated object and not a Singleton.

git-svn-id: http://svn.cleancode.org/svn/pickles@67 4d10bc64-7434-11dc-a737-d2d0f8310089
This commit is contained in:
Josh Sherman 2008-10-10 01:56:17 +00:00
parent bc84d6407d
commit ecf86b9818
7 changed files with 47 additions and 269 deletions

View file

@ -33,7 +33,7 @@
* @usage <code>$config = Config::getInstance();
*$config->node; // Returns SimpleXML object</code>
*/
class Config extends Singleton {
class Config {
/**
* Private instance of the Config class
@ -51,18 +51,24 @@ class Config extends Singleton {
private function __construct() { }
/**
* Gets an instance of the configuration object
* __clone
*/
public function __clone() {
trigger_error('Cloning is not available on a Singleton (that would defeat the purpose wouldn\'t it?)', E_USER_ERROR);
}
/**
* Gets an instance of the requested class object
*
* Determines if a Config object has already been instantiated,
* if so it will use it. If not, it will create one.
* Determines if a requested class object has already
* been instantiated, if so it will use it. If not,
* it will create one.
*
* @return An instace of the Config class
* @return An instace of the requested class
*/
public static function getInstance() {
$class = __CLASS__;
if (!self::$_instance instanceof $class) {
self::$_instance = new $class();
if (!self::$_instance instanceof Config) {
self::$_instance = new Config();
}
return self::$_instance;
@ -79,6 +85,7 @@ class Config extends Singleton {
* @todo Add the ability to load in multiple configuration files.
*/
public static function load($file) {
$config = Config::getInstance();
if (file_exists($file)) {