From d567a44eae592f77b3e07ca42f3261d88c9e51b1 Mon Sep 17 00:00:00 2001 From: Daniel Cannon Date: Wed, 18 Jul 2007 05:25:53 +0000 Subject: [PATCH] (bug 10602) API: Add two protected accessors to ApiMain allowing extending class to add to or override existing modules and formats. --- includes/api/ApiMain.php | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/includes/api/ApiMain.php b/includes/api/ApiMain.php index ceb16d24cd..24ba75cd1b 100644 --- a/includes/api/ApiMain.php +++ b/includes/api/ApiMain.php @@ -481,6 +481,31 @@ class ApiMain extends ApiBase { $vers[] = ApiFormatFeedWrapper :: getVersion(); // not accessible with format=xxx return $vers; } + + /** + * Add or overwrite a module in this ApiMain instance. Intended for use by extending + * classes who wish to add their own modules to their lexicon or override the + * behavior of inherent ones. + * + * @access protected + * @param $mdlName String The identifier for this module. + * @param $mdlClass String The class where this module is implemented. + */ + protected function addModule( $mdlName, $mdlClass ) { + $this->mModules[$mdlName] = $mdlClass; + } + + /** + * Add or overwrite an output format for this ApiMain. Intended for use by extending + * classes who wish to add to or modify current formatters. + * + * @access protected + * @param $fmtName The identifier for this format. + * @param $fmtClass The class implementing this format. + */ + protected function addFormat( $fmtName, $fmtClass ) { + $this->mFormats[$fmtName] = $fmtClass; + } } /** -- 2.20.1