예제 #1
0
 /**
  * Unregister a class loader as a delegate
  *
  * @param   lang.IClassLoader l
  * @return  bool TRUE if the delegate was unregistered
  */
 public static function removeLoader(IClassLoader $l)
 {
     $id = $l->instanceId();
     if (isset(self::$delegates[$id])) {
         unset(self::$delegates[$id]);
         if (isset(self::$modules[$id])) {
             if (Module::$INCOMPLETE !== self::$modules[$id]) {
                 Module::remove(self::$modules[$id]);
             }
             unset(self::$modules[$id]);
         }
         return true;
     }
     return false;
 }
예제 #2
0
 /**
  * Remove a registered module. Calls module's finalizer.
  *
  * @param  self $module
  */
 public static function remove(self $module)
 {
     $module->finalize();
     unset(self::$registered[$module->name()]);
 }
예제 #3
0
 public function module_implementation()
 {
     $cl = ClassLoader::defineInterface('net.xp_framework.unittest.reflection.IModule', []);
     $this->register(new LoaderProviding(['module.xp' => '<?php module xp-framework/impl implements net\\xp_framework\\unittest\\reflection\\IModule { }']));
     $this->assertTrue(in_array($cl, Module::forName('xp-framework/impl')->getClass()->getInterfaces()));
 }
예제 #4
0
 public function removes_registered_module()
 {
     $module = new Module('xp-framework/loaded1', $this->cl);
     Module::register($module);
     Module::remove($module);
     $this->assertFalse(Module::loaded($module->name()));
 }