示例#1
0
 /**
  * Protected constructor to prevent creating a new instance of the
  * *Singleton* via the `new` operator from outside of this class.
  */
 private function __construct()
 {
     \GTFramework\Loader::registerNamespace('GTFramework', dirname(__FILE__) . DIRECTORY_SEPARATOR);
     \GTFramework\Loader::registerAutoLoad();
     $this->_config = \GTFramework\Config::getInstance();
     if ($this->_config->_configFolder == NULL) {
         $this->_config->setConfigFolder('../config');
     }
     self::$logger = \GTFramework\Logger::getInstance();
 }
示例#2
0
 public function setConfigFolder($configFolder)
 {
     if (!$configFolder) {
         throw new \Exception('Empty config folder path!');
     }
     $_configFolder = realpath($configFolder);
     if ($_configFolder != FALSE && is_dir($_configFolder) && is_readable($_configFolder)) {
         $this->_configArray = array();
         $this->_configFolder = $_configFolder . DIRECTORY_SEPARATOR;
         $ns = $this->app['namespaces'];
         if (is_array($ns)) {
             //                echo '<pre>' . print_r($ns, TRUE) . '</pre>';
             \GTFramework\Loader::registerNamespaces($ns);
         }
     } else {
         throw new \Exception('Config directory read error: ' . $configFolder);
     }
 }