Esempio n. 1
0
File: Cache.php Progetto: rezon/sugi
 /**
  * @inheritdoc
  */
 protected static function _getInstance()
 {
     if (!static::$instance) {
         static::configure(Config::get("cache"));
     }
     return static::$instance;
 }
Esempio n. 2
0
 protected static function init()
 {
     if (is_null(static::$routes)) {
         static::$routes = new Container();
         if ($config = Config::get("routes")) {
             foreach ($config as $key => $route) {
                 static::add($key, $route["path"], Filter::key("defaults", $route, array()), Filter::key("requisites", $route, array()));
             }
         }
     }
 }
Esempio n. 3
0
 public static function getInstance()
 {
     if (!static::$db) {
         static::$db = static::factory(Config::get("database"));
         static::$registerEvents = Config::get("database.registerEvents", true);
         if (static::$registerEvents) {
             static::$db->hook("pre_open", function ($h) {
                 Event::fire("sugi.database.pre_open");
             });
             static::$db->hook("post_open", function ($h) {
                 Event::fire("sugi.database.post_open");
             });
             static::$db->hook("pre_query", function ($h, $query) {
                 Event::fire("sugi.database.pre_query", array("query" => $query));
             });
             static::$db->hook("post_query", function ($h, $query) {
                 Event::fire("sugi.database.post_query", array("query" => $query));
             });
         }
     }
     return static::$db;
 }
Esempio n. 4
0
 public function testFileNotFound()
 {
     $this->assertNull(Config::get("test99"));
 }