示例#1
0
 public function __construct()
 {
     if (func_num_args() > 0) {
         $config = func_get_arg(0);
         $this->setConfig($config);
     }
     Loader::getClass('Sky.core.Log')->write(100, get_class($this) . ' Class Initialize');
 }
示例#2
0
 function __construct($conf = [])
 {
     parent::__construct($conf);
     $this->uri = Loader::getClass('Sky.core.URI');
     $this->method = $this->getConfig('default_method');
     $this->setClass($this->getConfig('default_controller'));
     if (!$this->class) {
         Exceptions::showError("Server Error", "Unable to determine what should be displayed. A default route has not been specified in the routing file.");
         exit;
     }
     $this->_initialize();
 }
示例#3
0
 function __construct(array $params = [], Configuration $config = null, EventManager $eventManager = null)
 {
     if (!$params) {
         Config::load('App.DB');
         $params = Config::read('App.DB.connect');
     }
     parent::__construct();
     $this->db = DriverManager::getConnection($params, new Configuration());
     if ($this->db->connect()) {
         Loader::getClass('Sky.core.Log')->write(100, 'database connected');
     }
 }
示例#4
0
|--------------------------------------------------------------------------
*/
$BM = Loader::getClass('Sky.core.Benchmark');
$BM->mark('start_sky');
/*
|--------------------------------------------------------------------------
| initialize prase URI and Router
|--------------------------------------------------------------------------
*/
Config::load('App.Routes');
$RTR = Loader::getClass('Sky.core.Router', Config::read('App.Routes'));
$class = ucfirst($RTR->class);
$method = $RTR->method;
$OUT = Loader::getClass('Sky.core.Output');
if (Config::read('App.Base.enable_cache')) {
    $CH = Loader::getClass('Sky.core.Cache');
    if ($CH_OUT = $CH->read(implode($RTR->segments, '.'))) {
        $OUT->append(View::getTemp());
        $LOG->write(100, 'Cache Rendered');
        goto OUTPUT;
    }
}
/*
|--------------------------------------------------------------------------
| Starting Controller Benchmark
|--------------------------------------------------------------------------
*/
$BM->mark('start_controller');
$PATH = $RTR->getPath();
if (!file_exists($PATH)) {
    Exceptions::show404();