/** * Try loading a module at a given location * * @param string $module Module name * @param string $file File the class is in * @param string $class Class name of the module * @return mixed Framework_Module instance on success, * PEAR_Error otherwise. */ public static function tryModule($module, $file, $class) { if (!(include_once $file)) { throw new Framework_Exception('Module file not found: ' . $file, FRAMEWORK_MODULE_ERROR_INVALID_MODULE_FILE); } if (!class_exists($class)) { throw new Framework_Exception('Module class not found: ' . $module, FRAMEWORK_MODULE_ERROR_INVALID_MODULE_CLASS); } $instance = new $class(); if (!Framework_Module::isValid($instance)) { throw new Framework_Exception('Invalid module class loaded', FRAMEWORK_MODULE_ERROR_INVALID_MODULE_CLASS); } $instance->moduleName = $module; return $instance; }
/** * __destruct * * @access public * @return void */ public function __destruct() { parent::__destruct(); }
/** * Try loading a module at a given location * * @param string $module Module name * @param string $file File the class is in * @param string $class Class name of the module * @return mixed Framework_Module instance on success, * PEAR_Error otherwise. */ public static function &tryModule($module, $file, $class) { if (!(include_once $file)) { return PEAR::raiseError('Module file not found: ' . $file, FRAMEWORK_MODULE_ERROR_INVALID_MODULE_FILE); } if (!class_exists($class)) { return PEAR::raiseError('Module class not found: ' . $module, FRAMEWORK_MODULE_ERROR_INVALID_MODULE_CLASS); } try { $instance = new $class(); if (!Framework_Module::isValid($instance)) { return PEAR::raiseError('Invalid module class loaded'); } } catch (Framework_Exception $error) { return PEAR::raiseError($error->getMessage()); } $instance->moduleName = $module; return $instance; }
/** * stop * * @access public * @return mixed */ public function stop() { Framework_Module::stop(Framework::$module); }
/** * stop * * @access public * @return mixed */ public function stop() { $result = Framework_Module::stop(Framework::$module); if (PEAR::isError($result)) { return $result; } }