예제 #1
0
 /**
  * Return a static default instance of mr_autoload
  *
  * @return mr_autoload
  */
 public static function get_instance()
 {
     if (!self::$instance instanceof mr_autoload) {
         self::$instance = new mr_autoload();
     }
     return self::$instance;
 }
예제 #2
0
 /**
  * Run shutdown routine
  *
  * Recommended to call this when you don't want the Moodlerooms
  * Framework to conflict with other code, EG: when using the
  * framework on the cron.
  *
  * @return void
  */
 public static function shutdown()
 {
     if (self::$init) {
         // Stop autoloading all mr_* classes
         mr_autoload::unregister();
         // Reset!
         self::$init = false;
     }
 }
예제 #3
0
 public function test_unregister()
 {
     mr_autoload::register();
     mr_autoload::unregister();
     $autoloads = spl_autoload_functions();
     $this->assertIsA($autoloads, 'array');
     $found = false;
     foreach ($autoloads as $autoload) {
         if (is_array($autoload) and $autoload[0] instanceof mr_autoload) {
             $found = true;
         }
     }
     $this->assertFalse($found);
 }