More function and variable documentation
authorSam Reed <reedy@users.mediawiki.org>
Sat, 19 Feb 2011 01:02:56 +0000 (01:02 +0000)
committerSam Reed <reedy@users.mediawiki.org>
Sat, 19 Feb 2011 01:02:56 +0000 (01:02 +0000)
includes/parser/CoreLinkFunctions.php
includes/parser/CoreParserFunctions.php
includes/parser/CoreTagHooks.php
includes/parser/LinkHolderArray.php
includes/parser/Parser.php
includes/parser/ParserCache.php
includes/parser/ParserOptions.php
includes/parser/ParserOutput.php
includes/parser/Preprocessor_Hash.php
includes/search/SearchEngine.php

index 772ab0d..5c79649 100644 (file)
  * @ingroup Parser
  */
 class CoreLinkFunctions {
+       /**
+        * @static
+        * @param $parser Parser_LinkHooks
+        * @return bool
+        */
        static function register( $parser ) {
                $parser->setLinkHook( NS_CATEGORY, array( __CLASS__, 'categoryLinkHook' ) );
                return true;
        }
 
+       /**
+        * @static
+        * @param $parser Parser
+        * @param $holders LinkHolderArray
+        * @param $markers LinkMarkerReplacer
+        * @param Title $title
+        * @param $titleText
+        * @param null $displayText
+        * @param bool $leadingColon
+        * @return bool
+        */
        static function defaultLinkHook( $parser, $holders, $markers,
                        Title $title, $titleText, &$displayText = null, &$leadingColon = false ) {
                if( isset($displayText) && $markers->findMarker( $displayText ) ) {
@@ -28,6 +44,17 @@ class CoreLinkFunctions {
                return $holders->makeHolder( $title, isset($displayText) ? $displayText : $titleText, '', '', '' );
        }
 
+       /**
+        * @static
+        * @param  $parser Parser
+        * @param  $holders LinkHolderArray
+        * @param  $markers LinkMarkerReplacer
+        * @param Title $title
+        * @param  $titleText
+        * @param null $sortText
+        * @param bool $leadingColon
+        * @return bool|string
+        */
        static function categoryLinkHook( $parser, $holders, $markers,
                        Title $title, $titleText, &$sortText = null, &$leadingColon = false ) {
                global $wgContLang;
index d1ebc15..e59550a 100644 (file)
@@ -88,6 +88,12 @@ class CoreParserFunctions {
                }
        }
 
+       /**
+        * @static
+        * @param $parser Parser
+        * @param string $part1
+        * @return array
+        */
        static function intFunction( $parser, $part1 = '' /*, ... */ ) {
                if ( strval( $part1 ) !== '' ) {
                        $args = array_slice( func_get_args(), 2 );
@@ -99,6 +105,13 @@ class CoreParserFunctions {
                }
        }
 
+       /**
+        * @static
+        * @param $parser Parser
+        * @param  $date
+        * @param null $defaultPref
+        * @return mixed|string
+        */
        static function formatDate( $parser, $date, $defaultPref = null ) {
                $df = DateFormatter::getInstance();
 
@@ -176,6 +189,12 @@ class CoreParserFunctions {
                return $wgContLang->ucfirst( $s );
        }
 
+       /**
+        * @static
+        * @param $parser Parser
+        * @param string $s
+        * @return
+        */
        static function lc( $parser, $s = '' ) {
                global $wgContLang;
                if ( is_callable( array( $parser, 'markerSkipCallback' ) ) ) {
@@ -185,6 +204,12 @@ class CoreParserFunctions {
                }
        }
 
+       /**
+        * @static
+        * @param $parser Parser
+        * @param string $s
+        * @return
+        */
        static function uc( $parser, $s = '' ) {
                global $wgContLang;
                if ( is_callable( array( $parser, 'markerSkipCallback' ) ) ) {
@@ -223,6 +248,13 @@ class CoreParserFunctions {
                }
        }
 
+       /**
+        * @static
+        * @param $parser Parser
+        * @param string $num
+        * @param null $raw
+        * @return
+        */
        static function formatNum( $parser, $num = '', $raw = null) {
                if ( self::israw( $raw ) ) {
                        return $parser->getFunctionLang()->parseFormattedNumber( $num );
@@ -231,10 +263,23 @@ class CoreParserFunctions {
                }
        }
 
+       /**
+        * @static
+        * @param $parser Parser
+        * @param string $case
+        * @param string $word
+        * @return
+        */
        static function grammar( $parser, $case = '', $word = '' ) {
                return $parser->getFunctionLang()->convertGrammar( $word, $case );
        }
 
+       /**
+        * @static
+        * @param $parser Parser
+        * @param $user User
+        * @return
+        */
        static function gender( $parser, $user ) {
                wfProfileIn( __METHOD__ );
                $forms = array_slice( func_get_args(), 2);
@@ -259,6 +304,13 @@ class CoreParserFunctions {
                wfProfileOut( __METHOD__ );
                return $ret;
        }
+
+       /**
+        * @static
+        * @param $parser Parser
+        * @param string $text
+        * @return
+        */
        static function plural( $parser, $text = '' ) {
                $forms = array_slice( func_get_args(), 2 );
                $text = $parser->getFunctionLang()->parseFormattedNumber( $text );
index 5718b06..480e354 100644 (file)
@@ -52,6 +52,13 @@ class CoreTagHooks {
                return array( Xml::escapeTagsOnly( $content ), 'markerType' => 'nowiki' );
        }
 
+       /**
+        * @static
+        * @param  $content
+        * @param  $attributes
+        * @param $parser Parser
+        * @return
+        */
        static function math( $content, $attributes, $parser ) {
                global $wgContLang;
                return $wgContLang->armourMath( MathRenderer::renderMath( $content, $attributes, $parser->getOptions() ) );
index 4104289..05519c4 100644 (file)
@@ -66,6 +66,7 @@ class LinkHolderArray {
         * parsing of interwiki links, and secondly to allow all existence checks and
         * article length checks (for stub links) to be bundled into a single query.
         *
+        * @param $nt Title
         */
        function makeHolder( $nt, $text = '', $query = '', $trail = '', $prefix = ''  ) {
                wfProfileIn( __METHOD__ );
index d343ba6..ad22310 100644 (file)
@@ -119,7 +119,11 @@ class Parser {
 
        # Temporary
        # These are variables reset at least once per parse regardless of $clearState
-       var $mOptions;      # ParserOptions object
+
+       /**
+        * @var ParserOptions
+        */
+       var $mOptions;
        var $mTitle;        # Title context, used for self-link rendering and similar things
        var $mOutputType;   # Output type, one of the OT_xxx constants
        var $ot;            # Shortcut alias, see setOutputType()
@@ -614,6 +618,9 @@ class Parser {
                return $this->mLinkID++;
        }
 
+       /**
+        * @return Language
+        */
        function getFunctionLang() {
                global $wgLang, $wgContLang;
 
index 6192a1e..fbf7bb2 100644 (file)
@@ -37,6 +37,11 @@ class ParserCache {
                $this->mMemc = $memCached;
        }
 
+       /**
+        * @param $article Article
+        * @param  $hash
+        * @return mixed|string
+        */
        protected function getParserOutputKey( $article, $hash ) {
                global $wgRequest;
 
@@ -48,6 +53,10 @@ class ParserCache {
                return $key;
        }
 
+       /**
+        * @param $article Article
+        * @return mixed|string
+        */
        protected function getOptionsKey( $article ) {
                $pageid = $article->getID();
                return wfMemcKey( 'pcache', 'idoptions', "{$pageid}" );
@@ -62,6 +71,9 @@ class ParserCache {
         * $article. For example give a Chinese interface to a user with
         * English preferences. That's why we take into account *all* user
         * options. (r70809 CR)
+        *
+        * @param $article Article
+        * @param $popts ParserOptions
         */
        function getETag( $article, $popts ) {
                return 'W/"' . $this->getParserOutputKey( $article,
@@ -81,6 +93,9 @@ class ParserCache {
         * Used to provide a unique id for the PoolCounter.
         * It would be preferable to have this code in get()
         * instead of having Article looking in our internals.
+        *
+        * @param $article Article
+        * @param $popts ParserOptions
         */
        public function getKey( $article, $popts, $useOutdated = true ) {
                global $wgCacheEpoch;
@@ -160,7 +175,12 @@ class ParserCache {
                return $value;
        }
 
-
+       /**
+        * @param $parserOutput ParserOutput
+        * @param $article Article
+        * @param $popts ParserOptions
+        * @return void
+        */
        public function save( $parserOutput, $article, $popts ) {
                $expire = $parserOutput->getCacheExpiry();
 
index b8b2739..c975021 100644 (file)
@@ -43,6 +43,9 @@ class ParserOptions {
        var $mThumbSize;                 # Thumb size preferred by the user.
        var $mUserLang;                  # Language code of the User language.
 
+       /**
+        * @var User
+        */
        var $mUser;                      # Stored user object
        var $mIsPreview = false;         # Parsing the page for a "preview" operation
        var $mIsSectionPreview = false;  # Parsing the page for a "preview" operation on a single section
index caac802..d847fc7 100644 (file)
@@ -260,6 +260,12 @@ class ParserOutput extends CacheTime {
                $this->mImages[$name] = 1;
        }
 
+       /**
+        * @param $title Title
+        * @param  $page_id
+        * @param  $rev_id
+        * @return void
+        */
        function addTemplate( $title, $page_id, $rev_id ) {
                $ns = $title->getNamespace();
                $dbk = $title->getDBkey();
index cca03e7..45af9ee 100644 (file)
@@ -13,6 +13,9 @@
  * @ingroup Parser
  */
 class Preprocessor_Hash implements Preprocessor {
+       /**
+        * @var Parser
+        */
        var $parser;
 
        const CACHE_VERSION = 1;
@@ -81,7 +84,6 @@ class Preprocessor_Hash implements Preprocessor {
        function preprocessToObj( $text, $flags = 0 ) {
                wfProfileIn( __METHOD__ );
 
-
                // Check cache.
                global $wgMemc, $wgPreprocessorCacheThreshold;
 
index 984322d..379b292 100644 (file)
@@ -22,6 +22,11 @@ class SearchEngine {
        var $namespaces = array( NS_MAIN );
        var $showRedirects = false;
 
+       /**
+        * @var DatabaseBase
+        */
+       protected $db;
+
        function __construct($db = null) {
                if ( $db ) {
                        $this->db = $db;