/** * Class constructor * * The class constructor is private to avoid multiple instances of the * class (singleton). * * @return void */ private function __construct() { // Gets the instance of the environment class $this->_env = Woops_Core_Env_Getter::getInstance(); // Gets the instance of the error handler class $this->_errorReporting = Woops_Core_Error_Handler::getInstance(); // Not sure ADODB is completely error free $this->_errorReporting->disableErrorReporting(E_NOTICE | E_STRICT); require_once $this->_env->getPath('woops-mod://Adodb/resources/php/adodb5/adodb.inc.php'); // Resets the error reporting $this->_errorReporting->resetErrorReporting(); // Creates a directory iterator to find the available drivers $iterator = new DirectoryIterator($this->_env->getPath('woops-mod://Adodb/resources/php/adodb5/drivers/')); // Process each file foreach ($iterator as $file) { // Checks if the file is an ADODB driver if (substr($file->getFileName(), -8) === '.inc.php') { // Gets the driver name $driver = substr($file->getFileName(), 6, -8); // Stores the driver $this->_drivers[$driver] = true; } } // Stores additionnal drivers $this->_drivers['ifx'] = true; $this->_drivers['maxsql'] = true; $this->_drivers['pgsql'] = true; }
/** * Gets the unique class instance * * This method is used to get the unique instance of the class * (singleton). If no instance is available, it will create it. * * @return Woops_Core_Error_Handler The unique instance of the class * @see __construct */ public static function getInstance() { // Checks if the unique instance already exists if (!is_object(self::$_instance)) { // Creates the unique instance self::$_instance = new self(); } // Returns the unique instance return self::$_instance; }