From 4841ede9c3f7e616291b547ac6862dfe931c93c9 Mon Sep 17 00:00:00 2001 From: "Amir E. Aharoni" Date: Sun, 27 Sep 2015 16:12:36 +0300 Subject: [PATCH] Rewrite comments on member variables of ParserOutput as proper variables documentation This also makes lines short enough to pass phpcs. Bug: T102614 Change-Id: I11597bc052e8a8c2eaf4d60f7913e4186d0eb8e2 --- includes/parser/ParserOutput.php | 229 ++++++++++++++++++++++++++----- 1 file changed, 192 insertions(+), 37 deletions(-) diff --git a/includes/parser/ParserOutput.php b/includes/parser/ParserOutput.php index 2eb1dc9f95..3745238de8 100644 --- a/includes/parser/ParserOutput.php +++ b/includes/parser/ParserOutput.php @@ -22,42 +22,193 @@ * @ingroup Parser */ class ParserOutput extends CacheTime { - public $mText, # The output text - $mLanguageLinks, # List of the full text of language links, in the order they appear - $mCategories, # Map of category names to sort keys - $mIndicators = array(), # Page status indicators, usually displayed in top-right corner - $mTitleText, # title text of the chosen language variant - $mLinks = array(), # 2-D map of NS/DBK to ID for the links in the document. ID=zero for broken. - $mTemplates = array(), # 2-D map of NS/DBK to ID for the template references. ID=zero for broken. - $mTemplateIds = array(), # 2-D map of NS/DBK to rev ID for the template references. ID=zero for broken. - $mImages = array(), # DB keys of the images used, in the array key only - $mFileSearchOptions = array(), # DB keys of the images used mapped to sha1 and MW timestamp - $mExternalLinks = array(), # External link URLs, in the key only - $mInterwikiLinks = array(), # 2-D map of prefix/DBK (in keys only) for the inline interwiki links in the document. - $mNewSection = false, # Show a new section link? - $mHideNewSection = false, # Hide the new section link? - $mNoGallery = false, # No gallery on category page? (__NOGALLERY__) - $mHeadItems = array(), # Items to put in the section - $mModules = array(), # Modules to be loaded by the resource loader - $mModuleScripts = array(), # Modules of which only the JS will be loaded by the resource loader - $mModuleStyles = array(), # Modules of which only the CSSS will be loaded by the resource loader - $mJsConfigVars = array(), # JavaScript config variable for mw.config combined with this page - $mOutputHooks = array(), # Hook tags as per $wgParserOutputHooks - $mWarnings = array(), # Warning text to be returned to the user. Wikitext formatted, in the key only - $mSections = array(), # Table of contents - $mEditSectionTokens = false, # prefix/suffix markers if edit sections were output as tokens - $mProperties = array(), # Name/value pairs to be cached in the DB - $mTOCHTML = '', # HTML of the TOC - $mTimestamp, # Timestamp of the revision - $mTOCEnabled = true, # Whether TOC should be shown, can't override __NOTOC__ - $mEnableOOUI = false; # Whether OOUI should be enabled - private $mIndexPolicy = ''; # 'index' or 'noindex'? Any other value will result in no change. - private $mAccessedOptions = array(); # List of ParserOptions (stored in the keys) - private $mExtensionData = array(); # extra data used by extensions - private $mLimitReportData = array(); # Parser limit report data - private $mParseStartTime = array(); # Timestamps for getTimeSinceStart() - private $mPreventClickjacking = false; # Whether to emit X-Frame-Options: DENY - private $mFlags = array(); # Generic flags + /** + * @var string $mText The output text + */ + public $mText; + + /** + * @var array $mLanguageLinks List of the full text of language links, + * in the order they appear. + */ + public $mLanguageLinks; + + /** + * @var array $mCategoriesMap of category names to sort keys + */ + public $mCategories; + + /** + * @var array $mIndicators Page status indicators, usually displayed in top-right corner. + */ + public $mIndicators = array(); + + /** + * @var string $mTitleText Title text of the chosen language variant + */ + public $mTitleText; + + /** + * @var array $mLinks 2-D map of NS/DBK to ID for the links in the document. + * ID=zero for broken. + */ + public $mLinks = array(); + + /** + * @var array $mTemplates 2-D map of NS/DBK to ID for the template references. + * ID=zero for broken. + */ + public $mTemplates = array(); + + /** + * @var array $mTemplateIds 2-D map of NS/DBK to rev ID for the template references. + * ID=zero for broken. + */ + public $mTemplateIds = array(); + + /** + * @var array $mImages DB keys of the images used, in the array key only + */ + public $mImages = array(); + + /** + * @var array $mFileSearchOptions DB keys of the images used mapped to sha1 and MW timestamp. + */ + public $mFileSearchOptions = array(); + + /** + * @var array $mExternalLinks External link URLs, in the key only. + */ + public $mExternalLinks = array(); + + /** + * @var array $mInterwikiLinks 2-D map of prefix/DBK (in keys only) + * for the inline interwiki links in the document. + */ + public $mInterwikiLinks = array(); + + /** + * @var bool $mNewSection Show a new section link? + */ + public $mNewSection = false; + + /** + * @var bool $mHideNewSection Hide the new section link? + */ + public $mHideNewSection = false; + + /** + * @var bool $mNoGallery No gallery on category page? (__NOGALLERY__). + */ + public $mNoGallery = false; + + /** + * @var array $mHeadItems Items to put in the section + */ + public $mHeadItems = array(); + + /** + * @var array $mModules Modules to be loaded by the resource loader + */ + public $mModules = array(); + + /** + * @var array $mModuleScripts Modules of which only the JS will be loaded by + * the resource loader. + */ + public $mModuleScripts = array(); + + /** + * @var array $mModuleStyles Modules of which only the CSSS will be loaded by + * the resource loader. + */ + public $mModuleStyles = array(); + + /** + * @var array $mJsConfigVars JavaScript config variable for mw.config combined with this page. + */ + public $mJsConfigVars = array(); + + /** + * @var array $mOutputHooks Hook tags as per $wgParserOutputHooks. + */ + public $mOutputHooks = array(); + + /** + * @var array $mWarnings Warning text to be returned to the user. + * Wikitext formatted, in the key only. + */ + public $mWarnings = array(); + + /** + * @var array $mSections Table of contents + */ + public $mSections = array(); + + /** + * @var bool $mEditSectionTokens prefix/suffix markers if edit sections were output as tokens. + */ + public $mEditSectionTokens = false; + + /** + * @var array $mProperties Name/value pairs to be cached in the DB. + */ + public $mProperties = array(); + + /** + * @var string $mTOCHTML HTML of the TOC. + */ + public $mTOCHTML = ''; + + /** + * @var string $mTimestamp Timestamp of the revision. + */ + public $mTimestamp; + + /** + * @var bool $mTOCEnabled Whether TOC should be shown, can't override __NOTOC__. + */ + public $mTOCEnabled = true; + + /** + * @var bool $mEnableOOUI Whether OOUI should be enabled. + */ + public $mEnableOOUI = false; + + /** + * @var string $mIndexPolicy 'index' or 'noindex'? Any other value will result in no change. + */ + private $mIndexPolicy = ''; + + /** + * @var array $mAccessedOptions List of ParserOptions (stored in the keys). + */ + private $mAccessedOptions = array(); + + /** + * @var array $mExtensionData extra data used by extensions. + */ + private $mExtensionData = array(); + + /** + * @var array $mLimitReportData Parser limit report data. + */ + private $mLimitReportData = array(); + + /** + * @var array $mParseStartTime Timestamps for getTimeSinceStart(). + */ + private $mParseStartTime = array(); + + /** + * @var bool $mPreventClickjacking Whether to emit X-Frame-Options: DENY. + */ + private $mPreventClickjacking = false; + + /** + * @var array $mFlags Generic flags. + */ + private $mFlags = array(); const EDITSECTION_REGEX = '#<(?:mw:)?editsection page="(.*?)" section="(.*?)"(?:/>|>(.*?)())#'; @@ -715,7 +866,11 @@ class ParserOutput extends CacheTime { */ public function addSecondaryDataUpdate( DataUpdate $update ) { wfDeprecated( __METHOD__, '1.25' ); - throw new MWException( 'ParserOutput::addSecondaryDataUpdate() is no longer supported. Override Content::getSecondaryDataUpdates() or use the SecondaryDataUpdates hook instead.' ); + throw new MWException( + 'ParserOutput::addSecondaryDataUpdate() is no longer supported. ' . + 'Override Content::getSecondaryDataUpdates() ' . + 'or use the SecondaryDataUpdates hook instead.' + ); } /** -- 2.20.1