Пример #1
0
 public static function instance()
 {
     if (is_null(self::$instance)) {
         self::$instance = new self();
     }
     return self::$instance;
 }
Пример #2
0
 /**
  * Init Application
  */
 public static function Initialize()
 {
     /**
      * INI Values
      * ***TODO***
      * ***YOU CAN MOVE THIS TO YOUR PHP.INI FILE***
      */
     ini_set('display_errors', true);
     error_reporting(E_ALL);
     /**
      * Debug
      */
     self::$debug = Config\System::Get('debug');
 }
Пример #3
0
 public function __construct()
 {
     $configFilePath = dirname(__FILE__) . DIRECTORY_SEPARATOR . ".." . DIRECTORY_SEPARATOR . self::CONFIG_FILEPATH;
     self::$config = (include $configFilePath);
 }
Пример #4
0
 protected static function setConfig()
 {
     if (empty(self::$configPath)) {
         try {
             self::setConfigPath();
         } catch (\Exception $e) {
             echo 'Error setting config path ', $e->getMessage();
         }
     }
     $configFilePath = self::getConfigPath() . self::CONFIG_FILENAME;
     if (!file_exists($configFilePath)) {
         throw new \Exception(self::CONFIG_FILENAME . ' config file can not be found');
     }
     $configArray = (require $configFilePath);
     if (!is_array($configArray)) {
         throw new \Exception(self::CONFIG_FILENAME . ' config file should return an array');
     }
     self::$config = $configArray;
 }