https://www.mediawiki.org/wiki/Special:Code/MediaWiki/113576

Revision: 113576
Author:   reedy
Date:     2012-03-11 17:26:07 +0000 (Sun, 11 Mar 2012)
Log Message:
-----------
Flesh out most of the rest of the documentation

Modified Paths:
--------------
    trunk/extensions/LuaFoo/includes/Converter.php

Modified: trunk/extensions/LuaFoo/includes/Converter.php
===================================================================
--- trunk/extensions/LuaFoo/includes/Converter.php      2012-03-11 17:06:29 UTC 
(rev 113575)
+++ trunk/extensions/LuaFoo/includes/Converter.php      2012-03-11 17:26:07 UTC 
(rev 113576)
@@ -26,7 +26,7 @@
 
        /**
         * @param $title Title
-        * @param $language
+        * @param $language string
         * @return string
         */
        static function convert( $title, $language ) {
@@ -35,6 +35,9 @@
                return $code->toString();
        }
 
+       /**
+        * @param $language string
+        */
        protected function __construct( $language ) {
                $this->parser = new Parser;
                $this->preprocessor = new Preprocessor_Hash( $this->parser );
@@ -139,6 +142,10 @@
                }
        }
 
+       /**
+        * @param $expr LuaFoo_Converter_Expression
+        * @param $direction string
+        */
        protected function trimConcat( $expr, $direction ) {
                while ( count( $expr->args ) ) {
                        if ( $direction == 'left' ) {
@@ -168,8 +175,8 @@
        }
 
        /**
-        * @param $expr
-        * @param $deps
+        * @param $expr LuaFoo_Converter_Expression
+        * @param $deps LuaFoo_Converter_Deps
         * @return LuaFoo_Converter_Expression
         */
        function newTrim( $expr, $deps ) {
@@ -197,9 +204,9 @@
        }
 
        /**
-        * @param $name
-        * @param $args
-        * @param $deps
+        * @param $name string
+        * @param $args array
+        * @param $deps LuaFoo_Converter_Deps
         * @return LuaFoo_Converter_Expression
         */
        function newParserFunctionCall( $name, $args, $deps ) {
@@ -227,7 +234,6 @@
         * @return mixed|string
         */
        function titleToIdentifier( $title ) {
-               $id = '';
                if ( $title->getNamespace() == NS_TEMPLATE ) {
                        $id = 'tpl_';
                } elseif ( $title->getNamespace() == NS_MAIN ) {
@@ -273,7 +279,7 @@
 
        /**
         * @param $contextNode 
PPNode_Hash_Array|PPNode_Hash_Attr|PPNode_Hash_Text|PPNode_Hash_Tree
-        * @param $deps
+        * @param $deps LuaFoo_Converter_Deps
         * @return LuaFoo_Converter_Expression|mixed
         * @throws MWException
         */
@@ -318,7 +324,7 @@
 
        /**
         * @param $bits
-        * @param $deps
+        * @param $deps LuaFoo_Converter_Deps
         * @return LuaFoo_Converter_Expression|mixed
         */
        function expandTemplate( $bits, $deps ) {
@@ -431,8 +437,8 @@
        }
 
        /**
-        * @param $piece
-        * @param $deps
+        * @param $piece array
+        * @param $deps LuaFoo_Converter_Deps
         * @return LuaFoo_Converter_Expression
         */
        function expandTemplateArg( $piece, $deps ) {
@@ -466,7 +472,7 @@
 
        /**
         * @param $args
-        * @param $deps
+        * @param $deps LuaFoo_Converter_Deps
         * @return LuaFoo_Converter_Expression
         */
        function pfunc_if( $args, $deps ) {
@@ -499,6 +505,9 @@
        var $converter;
        var $runtimeBlocks;
 
+       /**
+        * @param $converter
+        */
        function __construct( $converter ) {
                $this->converter = $converter;
        }
@@ -520,6 +529,8 @@
 
        /**
         * @param $name
+        *
+        * @return LuaFoo_Converter_Block
         */
        function getRuntimeBlock( $name ) {
                if ( $this->runtimeBlocks === null ) {
@@ -831,7 +842,7 @@
                        }
 
                        $currentBlock->addItem( $line );
-               }       
+               }
        }
 
        /**
@@ -864,6 +875,9 @@
 class LuaFoo_Converter_Block {
        var $items = array(), $exprString = '', $language;
 
+       /**
+        * @param $language
+        */
        function __construct( $language ) {
                $this->language = $language;
        }
@@ -875,18 +889,30 @@
                }
        }
 
+       /**
+        * @param $item
+        */
        function prependItem( $item ) {
                array_unshift( $this->items, $item );
        }
 
+       /**
+        * @param $item
+        */
        function addItem( $item ) {
                $this->items[] = $item;
        }
 
+       /**
+        * @param $block
+        */
        function addBlock( $block ) {
                $this->addItems( $block->items );
        }
 
+       /**
+        * @param $expr string
+        */
        function setExpressionString( $expr ) {
                $this->exprString = $expr;
        }
@@ -957,6 +983,10 @@
        var $language;
        var $variablesByHash = array();
 
+       /**
+        * @param $language
+        * @param $seed string
+        */
        function __construct( $language, $seed ) {
                $this->language = $language;
                srand( crc32( $seed ) );
@@ -984,7 +1014,7 @@
        }
 
        /**
-        * @param $expr
+        * @param $expr LuaFoo_Converter_Expression
         * @return bool
         */
        public function getVariable( $expr ) {
@@ -996,15 +1026,25 @@
                }
        }
 
+       /**
+        * @param $var
+        * @param $expr LuaFoo_Converter_Expression
+        */
        public function setVariableHash( $var, $expr ) {
                $hash = $expr->getHash();
                $this->variablesByHash[$hash] = $var;
        }
 
+       /**
+        * @return mixed
+        */
        protected function getRandomVowel() {
                return self::$vowels[ rand( 0, strlen( self::$vowels ) - 1 ) ];
        }
 
+       /**
+        * @return mixed
+        */
        protected function getRandomConsonant() {
                return self::$consonants[ rand( 0, strlen( self::$consonants ) 
- 1 ) ];
        }
@@ -1014,18 +1054,30 @@
        var $titleTexts = array();
        var $functions = array();
 
+       /**
+        * @param $t string
+        */
        function addTemplate( $t ) {
                $this->titleTexts[$t] = true;
        }
 
+       /**
+        * @param $name string
+        */
        function addFunction( $name ) {
                $this->functions[$name] = true;
        }
 
+       /**
+        * @return array
+        */
        function getTemplates() {
                return array_keys( $this->titleTexts );
        }
 
+       /**
+        * @return array
+        */
        function getFunctions() {
                return array_keys( $this->functions );
        }


_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to