/** * 获得requset对象实例 */ public static function getRequest() { if (is_null(self::$instance) || !isset(self::$instance)) { self::$instance = new self(); } return self::$instance; }
/** * Resets singleton returned by getMain(). Should be called only from unit tests. */ public static function resetMain() { if (!(defined('MW_PHPUNIT_TEST') || defined('MW_PARSER_TEST'))) { throw new MWException(__METHOD__ . '() should be called only from unit tests!'); } self::$instance = null; }