Ejemplo n.º 1
0
 /**
  * Access to the Midgard MVC instance
  */
 public static function get_instance($dispatcher = null)
 {
     static $dispatcher_used = null;
     if (is_null($dispatcher_used)) {
         $dispatcher_used = $dispatcher;
     }
     if (!is_null($dispatcher) && $dispatcher != $dispatcher_used) {
         throw new BadMethodCallException("Dispatcher may be provided only once (using {$dispatcher_used} while you requested {$dispatcher})");
     }
     if (is_null(self::$instance)) {
         // Load instance
         self::$instance = new midgardmvc_core();
         if (is_null($dispatcher)) {
             self::$instance->load_base_services();
         } else {
             self::$instance->load_base_services($dispatcher);
         }
     }
     return self::$instance;
 }
Ejemplo n.º 2
0
 public static function clear_instance()
 {
     self::$instance = null;
 }