/** * 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; }
/** * Remove a registered module. Calls module's finalizer. * * @param self $module */ public static function remove(self $module) { $module->finalize(); unset(self::$registered[$module->name()]); }
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())); }
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())); }