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

Revision: 103452
Author:   questpc
Date:     2011-11-17 10:49:14 +0000 (Thu, 17 Nov 2011)
Log Message:
-----------
Remove the rest of object references via \&$. Do not create fake instance of 
qp_PollStore in Special:Pollresults. Correctly apply updated question 
definitions into DB. Array type hinting.

Modified Paths:
--------------
    trunk/extensions/QPoll/ctrl/poll/qp_abstractpoll.php
    trunk/extensions/QPoll/ctrl/poll/qp_poll.php
    trunk/extensions/QPoll/ctrl/poll/qp_pollstats.php
    trunk/extensions/QPoll/ctrl/qp_interpresult.php
    trunk/extensions/QPoll/ctrl/question/qp_abstractquestion.php
    trunk/extensions/QPoll/ctrl/question/qp_questionstats.php
    trunk/extensions/QPoll/ctrl/question/qp_stubquestion.php
    trunk/extensions/QPoll/ctrl/question/qp_textquestion.php
    trunk/extensions/QPoll/includes/qp_functionshook.php
    trunk/extensions/QPoll/includes/qp_renderer.php
    trunk/extensions/QPoll/includes/qp_xlswriter.php
    trunk/extensions/QPoll/interpretation/qp_eval.php
    trunk/extensions/QPoll/interpretation/qp_interpret.php
    trunk/extensions/QPoll/maintenance/qp_schemaupdater.php
    trunk/extensions/QPoll/model/cache/qp_pollcache.php
    trunk/extensions/QPoll/model/qp_pollstore.php
    trunk/extensions/QPoll/model/qp_question_collection.php
    trunk/extensions/QPoll/model/qp_questiondata.php
    trunk/extensions/QPoll/qp_user.php
    trunk/extensions/QPoll/specials/qp_results.php
    trunk/extensions/QPoll/specials/qp_special.php
    trunk/extensions/QPoll/view/proposal/qp_tabularquestionproposalview.php
    trunk/extensions/QPoll/view/proposal/qp_textquestionproposalview.php
    trunk/extensions/QPoll/view/qp_abstractview.php
    trunk/extensions/QPoll/view/qp_interpresultview.php
    trunk/extensions/QPoll/view/question/qp_stubquestionview.php
    trunk/extensions/QPoll/view/question/qp_tabularquestionview.php
    trunk/extensions/QPoll/view/question/qp_textquestionview.php
    trunk/extensions/QPoll/view/results/qp_questiondataresults.php
    trunk/extensions/QPoll/view/results/qp_textquestiondataresults.php
    trunk/extensions/QPoll/view/xls/qp_xlspoll.php
    trunk/extensions/QPoll/view/xls/qp_xlstabularquestion.php
    trunk/extensions/QPoll/view/xls/qp_xlstextquestion.php

Modified: trunk/extensions/QPoll/ctrl/poll/qp_abstractpoll.php
===================================================================
--- trunk/extensions/QPoll/ctrl/poll/qp_abstractpoll.php        2011-11-17 
10:33:20 UTC (rev 103451)
+++ trunk/extensions/QPoll/ctrl/poll/qp_abstractpoll.php        2011-11-17 
10:49:14 UTC (rev 103452)
@@ -99,7 +99,7 @@
         *
         * @public
         */
-       function __construct( $argv, qp_AbstractPollView $view ) {
+       function __construct( array $argv, qp_AbstractPollView $view ) {
                global $wgLanguageCode;
                $this->mResponse = qp_Setup::$request->response();
                # Determine which messages will be used, according to the 
language.
@@ -250,7 +250,7 @@
         * @modifies $paramkeys  array  key is attribute regexp, value is the 
value of attribute
         * @return   string  the value of question's type attribute
         */
-       function getQuestionAttributes( $attr_str, &$paramkeys ) {
+       function getQuestionAttributes( $attr_str, array &$paramkeys ) {
                $paramkeys = qp_Setup::getXmlLikeAttributes( $attr_str, 
$this->questionAttributeKeys );
                # apply default questions attributes from poll definition, if 
there is any
                foreach ( $this->defaultQuestionAttributes as $attr => $val ) {

Modified: trunk/extensions/QPoll/ctrl/poll/qp_poll.php
===================================================================
--- trunk/extensions/QPoll/ctrl/poll/qp_poll.php        2011-11-17 10:33:20 UTC 
(rev 103451)
+++ trunk/extensions/QPoll/ctrl/poll/qp_poll.php        2011-11-17 10:49:14 UTC 
(rev 103452)
@@ -54,7 +54,7 @@
        # maximal count of attepts of answer submission ( < 1 for infinite )
        var $maxAttempts = 0;
 
-       function __construct( $argv, qp_PollView $view ) {
+       function __construct( array $argv, qp_PollView $view ) {
                parent::__construct( $argv, $view );
                # dependance attr
                if ( array_key_exists( 'dependance', $argv ) ) {
@@ -374,8 +374,9 @@
        /**
         * Parse question main header (common question and XML attributes)
         * initializes common question and question type/subtype
-        * @param  $input  the question's header in QPoll syntax
-        * @return an instance of question that matches the header attributes
+        * @param  $header  string
+        *   the question's header in QPoll syntax
+        * @return  instance of question that matches the header attributes
         */
        function parseMainHeader( $header ) {
                # split common question and question attributes from the header
@@ -473,7 +474,7 @@
                if ( $this->mBeingCorrected ) {
                        if ( $question->getState() == '' ) {
                                # question is OK, store it into pollStore
-                               $this->pollStore->setQuestionAnswer( $question 
);
+                               $this->pollStore->setQuestion( $question );
                        } else {
                                # http post: not every proposals were answered: 
do not update DB
                                $this->pollStore->stateIncomplete();

Modified: trunk/extensions/QPoll/ctrl/poll/qp_pollstats.php
===================================================================
--- trunk/extensions/QPoll/ctrl/poll/qp_pollstats.php   2011-11-17 10:33:20 UTC 
(rev 103451)
+++ trunk/extensions/QPoll/ctrl/poll/qp_pollstats.php   2011-11-17 10:49:14 UTC 
(rev 103452)
@@ -42,7 +42,7 @@
  */
 class qp_PollStats extends qp_AbstractPoll {
 
-       function __construct( $argv, qp_PollStatsView $view ) {
+       function __construct( array $argv, qp_PollStatsView $view ) {
                parent::__construct( $argv, $view );
                $this->pollAddr = trim( $argv['address'] );
        }
@@ -99,7 +99,7 @@
                array_unshift( $unparsedAttributes, null );
                unset( $unparsedAttributes[0] );
                # first pass: parse the headers
-               foreach ( $this->pollStore->Questions as &$qdata ) {
+               foreach ( $this->pollStore->Questions as $qdata ) {
                        $question = new qp_QuestionStats(
                                $this,
                                qp_QuestionStatsView::newFromBaseView( 
$this->view ),
@@ -148,7 +148,7 @@
 
        # populate the question with data and build it's HTML representation
        # returns HTML representation of the question
-       function parseStats( qp_QuestionStats &$question ) {
+       function parseStats( qp_QuestionStats $question ) {
                # parse the question body
                if ( $question->getQuestionAnswer( $this->pollStore ) ) {
                        $question->statsParseBody();

Modified: trunk/extensions/QPoll/ctrl/qp_interpresult.php
===================================================================
--- trunk/extensions/QPoll/ctrl/qp_interpresult.php     2011-11-17 10:33:20 UTC 
(rev 103451)
+++ trunk/extensions/QPoll/ctrl/qp_interpresult.php     2011-11-17 10:49:14 UTC 
(rev 103452)
@@ -139,13 +139,16 @@
 
        /**
         * Build a projection of associative array tree to 2nd dimensional array
-        * @modifies  $strucTable  array  destination 2nd dimensional array
-        *            (see description in $this->getStructuredAnswerTable);
-        * @param     $structured  array  current node of associative array tree
-        * @param     $level_header  string  current "folder-like" prefix of
-        *            structured answer nested key (levels are separated with " 
/ ")
+        * @modifies  $strucTable  array
+        *   destination 2nd dimensional array;
+        *   see description in $this->getStructuredAnswerTable();
+        * @param  $structured  mixed
+        *   array / scalar current node of associative array tree
+        * @param  $level_header  string
+        *   current "folder-like" prefix of structured answer nested key
+        * (levels are separated with " / ")
         */
-       function buildStructuredTable( &$strucTable, &$structured, 
$level_header = '' ) {
+       function buildStructuredTable( array &$strucTable, &$structured, 
$level_header = '' ) {
                $keys = array();
                $vals = array();
                if ( is_array( $structured ) ) {

Modified: trunk/extensions/QPoll/ctrl/question/qp_abstractquestion.php
===================================================================
--- trunk/extensions/QPoll/ctrl/question/qp_abstractquestion.php        
2011-11-17 10:33:20 UTC (rev 103451)
+++ trunk/extensions/QPoll/ctrl/question/qp_abstractquestion.php        
2011-11-17 10:49:14 UTC (rev 103452)
@@ -85,7 +85,7 @@
         * @param   $attr_str - source text with question attributes
         * @return  string : type of the question, empty when not defined
         */
-       function applyAttributes( $paramkeys ) {
+       function applyAttributes( array $paramkeys ) {
                $this->view->setLayout( $paramkeys[ 'layout' ], $paramkeys[ 
'textwidth' ] );
                $this->view->setShowResults( $paramkeys[ 'showresults' ] );
                $this->view->setPropWidth( $paramkeys[ 'propwidth' ] );

Modified: trunk/extensions/QPoll/ctrl/question/qp_questionstats.php
===================================================================
--- trunk/extensions/QPoll/ctrl/question/qp_questionstats.php   2011-11-17 
10:33:20 UTC (rev 103451)
+++ trunk/extensions/QPoll/ctrl/question/qp_questionstats.php   2011-11-17 
10:49:14 UTC (rev 103452)
@@ -25,7 +25,7 @@
        # load some question fields from qp_QuestionData given
        # (usually qp_QuestionData is a property of qp_PollStore instance)
        # @param  $qdata - an instance of qp_QuestionData
-       function loadAnswer( qp_QuestionData &$qdata ) {
+       function loadAnswer( qp_QuestionData $qdata ) {
                $this->alreadyVoted = $qdata->alreadyVoted;
                $this->mCommonQuestion = $qdata->CommonQuestion;
                $this->mProposalText = $qdata->ProposalText;
@@ -41,7 +41,7 @@
 
        # populates an instance of qp_Question with data from qp_QuestionData
        # input: the object of type qp_Question
-       function getQuestionAnswer( qp_PollStore &$pollStore ) {
+       function getQuestionAnswer( qp_PollStore $pollStore ) {
                if ( $pollStore->pid !== null ) {
                        if ( $pollStore->questionExists( $this->mQuestionId ) ) 
{
                                $qdata = $pollStore->Questions[ 
$this->mQuestionId ];

Modified: trunk/extensions/QPoll/ctrl/question/qp_stubquestion.php
===================================================================
--- trunk/extensions/QPoll/ctrl/question/qp_stubquestion.php    2011-11-17 
10:33:20 UTC (rev 103451)
+++ trunk/extensions/QPoll/ctrl/question/qp_stubquestion.php    2011-11-17 
10:49:14 UTC (rev 103452)
@@ -33,7 +33,7 @@
        # load some question fields from qp_QuestionData given
        # (usually qp_QuestionData is an array property of qp_PollStore 
instance)
        # @param   $qdata - an instance of qp_QuestionData
-       function loadAnswer( qp_QuestionData &$qdata ) {
+       function loadAnswer( qp_QuestionData $qdata ) {
                $this->alreadyVoted = $qdata->alreadyVoted;
                $this->mPrevProposalCategoryId = $qdata->ProposalCategoryId;
                $this->mPrevProposalCategoryText = $qdata->ProposalCategoryText;
@@ -47,7 +47,7 @@
 
        # populates an instance of qp_Question with data from qp_QuestionData
        # @param   the object of type qp_Question
-       function getQuestionAnswer( qp_PollStore &$pollStore ) {
+       function getQuestionAnswer( qp_PollStore $pollStore ) {
                if ( $pollStore->pid !== null ) {
                        if ( $pollStore->questionExists( $this->mQuestionId ) ) 
{
                                $qdata = $pollStore->Questions[ 
$this->mQuestionId ];
@@ -95,12 +95,13 @@
        }
 
        /**
-        * @return  associative array of script-generated interpretation error
-        *          messages for current question proposals (and optionally 
categories)
-        *          false, when there are no script-generated error messages
+        * @return  mixed
+        *   array  (associative) of script-generated interpretation error 
messages
+        *     for current question proposals (and optionally categories);
+        *   boolean  false, when there are no script-generated error messages;
         */
        function getInterpErrors() {
-               $interpResult = &$this->poll->pollStore->interpResult;
+               $interpResult = $this->poll->pollStore->interpResult;
                if ( !is_array( $interpResult->qpcErrors ) ||
                                !isset( 
$interpResult->qpcErrors[$this->mQuestionId] ) ) {
                        return false;

Modified: trunk/extensions/QPoll/ctrl/question/qp_textquestion.php
===================================================================
--- trunk/extensions/QPoll/ctrl/question/qp_textquestion.php    2011-11-17 
10:33:20 UTC (rev 103451)
+++ trunk/extensions/QPoll/ctrl/question/qp_textquestion.php    2011-11-17 
10:49:14 UTC (rev 103452)
@@ -252,11 +252,10 @@
        /**
         * Applies previousely parsed attributes from main header into 
question's view
         * (all attributes but type)
-        *
-        * @param   $attr_str - source text with question attributes
-        * @return  string : type of the question, empty when not defined
+        * @param  $paramkeys array
+        *   key is attribute name regexp match, value is the value of attribute
         */ 
-       function applyAttributes( $paramkeys ) {
+       function applyAttributes( array $paramkeys ) {
                parent::applyAttributes( $paramkeys );
                if ( $this->mSubType === 'requireAllCategories' ) {
                        # radio button prevents from filling all categories, 
disable it

Modified: trunk/extensions/QPoll/includes/qp_functionshook.php
===================================================================
--- trunk/extensions/QPoll/includes/qp_functionshook.php        2011-11-17 
10:33:20 UTC (rev 103451)
+++ trunk/extensions/QPoll/includes/qp_functionshook.php        2011-11-17 
10:49:14 UTC (rev 103452)
@@ -50,9 +50,9 @@
 
        var $error_message = 'no_such_poll';
 
-       function qpuserchoice( &$parser, $frame, $args ) {
+       function qpuserchoice( Parser &$parser, PPFrame $frame, array $args ) {
                qp_Setup::onLoadAllMessages();
-               $this->frame = &$frame;
+               $this->frame = $frame;
                $this->args = &$args;
                if ( isset( $args[ 0 ] ) ) {
                        # args[0] is a poll address
@@ -101,7 +101,7 @@
                return false;
        }
 
-       function qpuserchoiceValidResult( $qdata ) {
+       function qpuserchoiceValidResult( qp_QuestionData $qdata ) {
                $result = '';
                if ( array_key_exists( $this->proposal_id, 
$qdata->ProposalCategoryId ) ) {
                        foreach ( $qdata->ProposalCategoryId[ 
$this->proposal_id ] as $id_key => $cat_id ) {

Modified: trunk/extensions/QPoll/includes/qp_renderer.php
===================================================================
--- trunk/extensions/QPoll/includes/qp_renderer.php     2011-11-17 10:33:20 UTC 
(rev 103451)
+++ trunk/extensions/QPoll/includes/qp_renderer.php     2011-11-17 10:49:14 UTC 
(rev 103452)
@@ -52,11 +52,13 @@
 
        /**
         * Renders nested tag array into string
-        * @param   $tag  multidimensional array of xml/html tags
+        * @param   $tag  mixed
+        *   array  (multidimensional) of xml/html tags;
+        *   string single text node;
         * @return  string  representation of xml/html
         *
         * the stucture of $tag is like this:
-        * array( "__tag"=>"td", "class"=>"myclass", 0=>"text before li", 
1=>array( "__tag"=>"li", 0=>"text inside li" ), 2=>"text after li" )
+        * array( '__tag'=>'td', 'class'=>'myclass', 0=>'text before li', 
1=>array( '__tag'=>'li', 0=>'text inside li' ), 2=>'text after li' )
         *
         * both tagged and tagless lists are supported
         */
@@ -127,7 +129,7 @@
        /**
         * add one or more CSS class name to tag class attribute
         */
-       static function addClass( &$tag, $className ) {
+       static function addClass( array &$tag, $className ) {
                if ( !isset( $tag['class'] ) ) {
                        $tag['class'] = $className;
                        return;
@@ -152,8 +154,11 @@
         *         each element of resulting tagarray
         * @return array  tagarray
         */
-       static function tagList( $row, $destinationAttr = 0, $rowattrs = array( 
'__tag' => 'td' ) ) {
-               if ( count( $row ) <= 0 ) {
+       static function tagList(
+                       array $row,
+                       $destinationAttr = 0,
+                       array $rowattrs = array( '__tag' => 'td' ) ) {
+               if ( count( $row ) < 1 ) {
                        return '';
                }
                $result = array();
@@ -174,7 +179,11 @@
         * destination cell xml attributes ("name"=>0, "count"=>colspan" )
         * @return array of destination cells
         */
-       static function newRow( $row, $rowattrs = "", $celltag = "td", 
$attribute_maps = null ) {
+       static function newRow(
+                       array $row,
+                       array $rowattrs = array(),
+                       $celltag = "td",
+                       array $attribute_maps = array() ) {
                $result = "";
                if ( count( $row ) > 0 ) {
                        foreach ( $row as &$cell ) {
@@ -183,21 +192,18 @@
                                }
                                $cell['__tag'] = $celltag;
                                $cell['__end'] = "\n";
-                               if ( is_array( $attribute_maps ) ) {
-                                       # converts ("count"=>3) to 
("colspan"=>3) in table headers - don't use frequently
-                                       foreach ( $attribute_maps as $key => 
$val ) {
-                                               if ( array_key_exists( $key, 
$cell ) ) {
-                                                       $cell[ $val ] = $cell[ 
$key ];
-                                                       unset( $cell[ $key ] );
-                                               }
+                               # converts ("count"=>3) to ("colspan"=>3) in 
table headers
+                               # please don't use frequently, because it's 
inefficient
+                               foreach ( $attribute_maps as $key => $val ) {
+                                       if ( array_key_exists( $key, $cell ) ) {
+                                               $cell[ $val ] = $cell[ $key ];
+                                               unset( $cell[ $key ] );
                                        }
                                }
                        }
                        $result = array( '__tag' => 'tr', 0 => $row, '__end' => 
"\n" );
-                       if ( is_array( $rowattrs ) ) {
+                       if ( count( $rowattrs ) > 0 ) {
                                $result = array_merge( $rowattrs, $result );
-                       } elseif ( $rowattrs !== "" )  {
-                               $result[0][] = __METHOD__ . ':invalid rowattrs 
supplied';
                        }
                }
                return $result;
@@ -207,7 +213,12 @@
         * Add row to the table
         * todo: document
         */
-       static function addRow( &$table, $row, $rowattrs = "", $celltag = "td", 
$attribute_maps = null ) {
+       static function addRow(
+                       array &$table,
+                       array $row,
+                       array $rowattrs = array(),
+                       $celltag = "td",
+                       array $attribute_maps = array() ) {
                $table[] = self::newRow( $row, $rowattrs, $celltag, 
$attribute_maps );
        }
 
@@ -215,7 +226,12 @@
         * Add column to the table
         * todo: document
         */
-       static function addColumn( &$table, $column, $rowattrs = "", $celltag = 
"td", $attribute_maps = null ) {
+       static function addColumn(
+                       array &$table,
+                       array $column,
+                       array $rowattrs = array(),
+                       $celltag = "td",
+                       array $attribute_maps = array() ) {
                if ( count( $column ) > 0 ) {
                        $row = 0;
                        foreach ( $column as &$cell ) {
@@ -224,19 +240,15 @@
                                }
                                $cell[ '__tag' ] = $celltag;
                                $cell[ '__end' ] = "\n";
-                               if ( is_array( $attribute_maps ) ) {
-                                       # converts ("count"=>3) to 
("rowspan"=>3) in table headers - don't use frequently
-                                       foreach ( $attribute_maps as $key => 
$val ) {
-                                               if ( array_key_exists( $key, 
$cell ) ) {
-                                                       $cell[ $val ] = $cell[ 
$key ];
-                                                       unset( $cell[ $key ] );
-                                               }
+                               # converts ("count"=>3) to ("rowspan"=>3) in 
table headers - don't use frequently
+                               foreach ( $attribute_maps as $key => $val ) {
+                                       if ( array_key_exists( $key, $cell ) ) {
+                                               $cell[ $val ] = $cell[ $key ];
+                                               unset( $cell[ $key ] );
                                        }
                                }
-                               if ( is_array( $rowattrs ) ) {
+                               if ( count( $rowattrs ) > 0 ) {
                                        $cell = array_merge( $rowattrs, $cell );
-                               } elseif ( $rowattrs !== "" ) {
-                                       $cell[ 0 ] = __METHOD__ . ':invalid 
rowattrs supplied';
                                }
                                if ( !array_key_exists( $row, $table ) ) {
                                        $table[ $row ] = array( '__tag' => 
'tr', '__end' => "\n" );
@@ -252,7 +264,11 @@
                }
        }
 
-       static function displayRow( $row, $rowattrs = "", $celltag = "td", 
$attribute_maps = null ) {
+       static function displayRow(
+                       array $row,
+                       array $rowattrs = array(),
+                       $celltag = "td",
+                       array $attribute_maps = array() ) {
                # temporary var $tagsrow used to avoid warning in E_STRICT mode
                $tagsrow = self::newRow( $row, $rowattrs, $celltag, 
$attribute_maps );
                return self::renderTagArray( $tagsrow );
@@ -262,8 +278,8 @@
         * use newRow() or addColumn() to add resulting row/column to the table
         * if you want to use the resulting row with renderTagArray(), don't 
forget to apply attrs=array('__tag'=>'td')
         */
-       static function applyAttrsToRow( &$row, $attrs ) {
-               if ( is_array( $attrs ) && count( $attrs > 0 ) ) {
+       static function applyAttrsToRow( array &$row, array $attrs ) {
+               if ( count( $attrs > 0 ) ) {
                        foreach ( $row as &$cell ) {
                                if ( !is_array( $cell ) ) {
                                        $cell = array_merge( $attrs, array( 
$cell ) );

Modified: trunk/extensions/QPoll/includes/qp_xlswriter.php
===================================================================
--- trunk/extensions/QPoll/includes/qp_xlswriter.php    2011-11-17 10:33:20 UTC 
(rev 103451)
+++ trunk/extensions/QPoll/includes/qp_xlswriter.php    2011-11-17 10:49:14 UTC 
(rev 103452)
@@ -92,7 +92,7 @@
         * for cell formatting; we store these instances in self::$format array
         * and then address these by passing array keys (strings with format 
"name").
         */
-       function addFormats( $formats ) {
+       function addFormats( array $formats ) {
                foreach ( $formats as $fkey => $fdef ) {
                        self::$fdef[$fkey] = $fdef;
                        self::$format[$fkey] = self::$wb->addformat( $fdef );
@@ -176,7 +176,7 @@
        /**
         * Write 2d-table of data into selected column of the current row.
         */
-       function writeFormattedTable( $colnum, &$table, $fkey = 'null' ) {
+       function writeFormattedTable( $colnum, array &$table, $fkey = 'null' ) {
                $ws = self::$ws;
                foreach ( $table as $rnum => &$row ) {
                        foreach ( $row as $cnum => &$cell ) {

Modified: trunk/extensions/QPoll/interpretation/qp_eval.php
===================================================================
--- trunk/extensions/QPoll/interpretation/qp_eval.php   2011-11-17 10:33:20 UTC 
(rev 103451)
+++ trunk/extensions/QPoll/interpretation/qp_eval.php   2011-11-17 10:49:14 UTC 
(rev 103452)
@@ -224,9 +224,10 @@
 
        /**
         * Calls php interpreter to lint interpretation script code
-        * @param  $code   string with php code
-        * @return bool    true, when code has no syntax errors;
-        *         string  error message from php lint
+        * @param  $code string with php code
+        * @return mixed
+        *   boolean  true, when code has no syntax errors;
+        *   string  error message from php lint;
         */
        static function lint( $code ) {
                $pipes = array();
@@ -312,9 +313,13 @@
        /**
         * Checks the submitted eval code for errors
         * In case of success returns transformed code, which is safer for eval
-        * @param $sourceCode  submitted code which has to be eval'ed (no php 
tags)
-        * @param $destinationCode  transformed code (in case of success) (no 
php tags)
-        * @return boolean true in case of success, string with error message 
on failure
+        * @param $sourceCode  string
+        *   submitted code which has to be eval'ed (no php tags)
+        * @param $destinationCode  string
+        *   transformed code (in case of success) (no php tags)
+        * @return mixed
+        *   boolean  true in case of success;
+        *   string  error message on failure;
         */
        static function checkAndTransformCode( $sourceCode, &$destinationCode ) 
{
 
@@ -382,18 +387,22 @@
 
        /**
         * Interpretates the answer with selected script
-        * @param $interpretScript  string source code of interpretation script
-        * @param $injectVars       array of PHP data to inject into 
interpretation script;
-        *                          key of element will become variable name
-        *                          in the interpretation script;
-        *                          value of element will become variable value
-        *                          in the interpretation script;
-        * @param $interpResult     instance of qp_InterpResult class
+        * @param $interpretScript
+        *   string  source code of interpretation script
+        * @param $injectVars
+        *   array of PHP data to inject into interpretation script;
+        *     key of element will become variable name in the interpretation 
script;
+        *     value of element will become variable value in the 
interpretation script;
+        * @param $interpResult  qp_InterpResult
         * @modifies $interpResult
-        * @return                  array script result to check, or
-        *                          qp_InterpResult $interpResult (in case of 
error)
+        * @return  mixed
+        *   array script result to check
+        *   qp_InterpResult  $interpResult (in case of error)
         */
-       static function interpretAnswer( $interpretScript, $injectVars, 
qp_InterpResult $interpResult ) {
+       static function interpretAnswer(
+                       $interpretScript,
+                       array $injectVars,
+                       qp_InterpResult $interpResult ) {
                # template page evaluation
                if ( ( $check = self::selfCheck() ) !== true ) {
                        # self-check error

Modified: trunk/extensions/QPoll/interpretation/qp_interpret.php
===================================================================
--- trunk/extensions/QPoll/interpretation/qp_interpret.php      2011-11-17 
10:33:20 UTC (rev 103451)
+++ trunk/extensions/QPoll/interpretation/qp_interpret.php      2011-11-17 
10:49:14 UTC (rev 103452)
@@ -68,7 +68,7 @@
         *                     or false, when the poll questions were not 
randomized
         * @return instance of qp_InterpResult class (interpretation result)
         */
-       static function getResult( $interpArticle, $injectVars ) {
+       static function getResult( Article $interpArticle, array $injectVars ) {
                global $wgParser, $wgContLang;
                $matches = array();
                # extract <qpinterpret> tags from the article content

Modified: trunk/extensions/QPoll/maintenance/qp_schemaupdater.php
===================================================================
--- trunk/extensions/QPoll/maintenance/qp_schemaupdater.php     2011-11-17 
10:33:20 UTC (rev 103451)
+++ trunk/extensions/QPoll/maintenance/qp_schemaupdater.php     2011-11-17 
10:49:14 UTC (rev 103452)
@@ -123,7 +123,7 @@
         * @param  $tableset  array list of DB tables in set
         * @return  array with names of non-existing tables in specified list
         */
-       private static function tablesExists( $tableset ) {
+       private static function tablesExists( array $tableset ) {
                $db = & wfGetDB( DB_MASTER );
                $tablesNotFound = array();
                foreach ( $tableset as &$table ) {

Modified: trunk/extensions/QPoll/model/cache/qp_pollcache.php
===================================================================
--- trunk/extensions/QPoll/model/cache/qp_pollcache.php 2011-11-17 10:33:20 UTC 
(rev 103451)
+++ trunk/extensions/QPoll/model/cache/qp_pollcache.php 2011-11-17 10:49:14 UTC 
(rev 103452)
@@ -284,7 +284,7 @@
                $this->updateFromPollStore();
                if ( count( $this->replace ) < 1 ) {
                        # this cannot happen here; however it can happen in 
ancestor classes
-                       throw new Exception( "zero rows replace in " . 
__METHOD__ );
+                       throw new MWException( "zero rows replace in " . 
__METHOD__ );
                }
                $replaceRows = ( $curr_cache_rows = $wgMemc->get( 
$this->getMemcKey() ) ) === false ||
                        serialize( $curr_cache_rows ) !== serialize( 
$this->memc_rows );

Modified: trunk/extensions/QPoll/model/qp_pollstore.php
===================================================================
--- trunk/extensions/QPoll/model/qp_pollstore.php       2011-11-17 10:33:20 UTC 
(rev 103451)
+++ trunk/extensions/QPoll/model/qp_pollstore.php       2011-11-17 10:49:14 UTC 
(rev 103452)
@@ -86,38 +86,39 @@
         * @param $argv['from'] indicates type of construction, other elements 
of $argv
         *          vary according to the value of 'from'
         */
-       function __construct( $argv = null ) {
+       function __construct( array $argv ) {
                $this->interpResult = new qp_InterpResult();
                # set poll store of poll descriptions cache and all it's 
ancestors
                qp_PollCache::setStore( $this );
-               if ( is_array( $argv ) && array_key_exists( "from", $argv ) ) {
+               $from = 'null';
+               if ( array_key_exists( 'from', $argv ) ) {
+                       $from = $argv['from'];
                        $this->Questions = array();
                        $this->mCompletedPostData = 'NA';
                        $this->pid = null;
                        $is_post = false;
-                       switch ( $argv[ 'from' ] ) {
-                               case 'poll_post' :
-                                       $is_post = true;
-                               case 'poll_get' :
-                                       $this->createFromTagData( $argv, 
$is_post );
-                                       break;
-                               case 'pid' :
-                                       if ( array_key_exists( 'pid', $argv ) ) 
{
-                                               $pid = intval( $argv[ 'pid' ] );
-                                               $this->createFromPid( $pid );
-                                       }
-                                       break;
-                               default :
-                                       throw new MWException( 'Unknown value 
of "from" parameter: ' . $argv[ 'from' ] . ' in ' . __METHOD__ );
+                       switch ( $from ) {
+                       case 'poll_post' :
+                               $is_post = true;
+                       case 'poll_get' :
+                               $this->createFromTagData( $argv, $is_post );
+                               return;
+                       case 'pid' :
+                               if ( array_key_exists( 'pid', $argv ) ) {
+                                       $pid = intval( $argv[ 'pid' ] );
+                                       $this->createFromPid( $pid );
+                               }
+                               return;
                        }
                }
+               throw new MWException( 'Unknown value of "from" parameter: ' . 
$from . ' in ' . __METHOD__ );
        }
 
        /**
         * Creates new poll from data available in qpoll tag attributes.
         * Usually that is HTTP GET / POST operation.
         */
-       function createFromTagData( &$argv, $is_post ) {
+       function createFromTagData( array &$argv, $is_post ) {
                global $wgParser;
                if ( array_key_exists( 'title', $argv ) ) {
                        $title = $argv[ 'title' ];
@@ -824,7 +825,7 @@
         * Get username by uid
         * @param  $uid  integer  qpoll user id
         */
-       function getUserName( $uid ) {
+       static function getUserName( $uid ) {
                $db = wfGetDB( DB_MASTER );
                if ( $uid !== null ) {
                        $res = $db->select(
@@ -908,13 +909,14 @@
         * @param  $question  qp_StubQuestion
         *   instance of question which has current user vote
         */
-       public function setQuestionAnswer( qp_StubQuestion $question ) {
+       public function setQuestion( qp_StubQuestion $question ) {
                if ( $this->questionExists( $question->mQuestionId ) ) {
                        # question data already exists, poll structure was 
stored during previous
                        # submission.
                        # question, category and proposal descriptions are 
already loaded into
                        # $this->Questions[$question->mQuestionId] by 
$this->loadQuestions()
-                       
$this->Questions[$question->mQuestionId]->setQuestionAnswer( $question );
+                       # but might have pending update, if the source of the 
poll was modified
+                       
$this->Questions[$question->mQuestionId]->applyQuestion( $question );
                } else {
                        # create new question data from scratch (first 
submission)
                        $this->Questions[$question->mQuestionId] = 
qp_QuestionData::factory( $question );

Modified: trunk/extensions/QPoll/model/qp_question_collection.php
===================================================================
--- trunk/extensions/QPoll/model/qp_question_collection.php     2011-11-17 
10:33:20 UTC (rev 103451)
+++ trunk/extensions/QPoll/model/qp_question_collection.php     2011-11-17 
10:49:14 UTC (rev 103452)
@@ -65,7 +65,7 @@
         * placed in $except. ($except must therefore be an array)
         * function returns false if $except holds all values between $min and 
$max.
         */
-       function rand_except( $min, $max, $except ) {
+       function rand_except( $min, $max, array $except ) {
                # first sort array values
                sort( $except, SORT_NUMERIC );
                # calculate average gap between except-values
@@ -112,7 +112,7 @@
 
        function setUsedQuestions( $randomQuestions ) {
                if ( !is_array( $randomQuestions ) ) {
-                       foreach ( $this->questions as $qidx => &$question ) {
+                       foreach ( $this->questions as $qidx => $question ) {
                                $question->usedId = $question->mQuestionId;
                        }
                        return;
@@ -121,7 +121,7 @@
                $this->usedQuestions = array();
                # questions keys start from 1
                $usedId = 1;
-               foreach ( $this->questions as $qidx => &$question ) {
+               foreach ( $this->questions as $qidx => $question ) {
                        if ( in_array( $qidx, $randomQuestions, true ) ) {
                                # usedQuestions keys start from 0
                                $this->usedQuestions[] = $qidx;
@@ -149,7 +149,7 @@
 
        function usedCount() {
                $used = 0;
-               foreach ( $this->questions as &$question ) {
+               foreach ( $this->questions as $question ) {
                        if ( $question->usedId !== false ) {
                                $used++;
                        }

Modified: trunk/extensions/QPoll/model/qp_questiondata.php
===================================================================
--- trunk/extensions/QPoll/model/qp_questiondata.php    2011-11-17 10:33:20 UTC 
(rev 103451)
+++ trunk/extensions/QPoll/model/qp_questiondata.php    2011-11-17 10:49:14 UTC 
(rev 103452)
@@ -64,14 +64,7 @@
                        return;
                } elseif ( $argv instanceof qp_StubQuestion ) {
                        # create question data from the already existing 
question
-                       $this->question_id = $argv->mQuestionId;
-                       $this->type = $argv->mType;
-                       $this->CommonQuestion = $argv->mCommonQuestion;
-                       $this->Categories = $argv->mCategories;
-                       $this->CategorySpans = $argv->mCategorySpans;
-                       $this->ProposalText = $argv->mProposalText;
-                       $this->ProposalNames = $argv->mProposalNames;
-                       $this->setQuestionAnswer( $argv );
+                       $this->applyQuestion( $argv );
                        return;
                }
                throw new MWException( "argv is neither an array nor instance 
of qp_QuestionData in " . __METHOD__ );
@@ -114,7 +107,7 @@
         *
         * Used to reject previous vote in case the header is incompatble.
         */
-       function isCompatible( &$question ) {
+       function isCompatible( qp_StubQuestion $question ) {
                if ( $question->mType != $this->type ) {
                        return false;
                }
@@ -206,7 +199,14 @@
                return ( $name !== '' ) ? ":|{$name}|" : '';
        }
 
-       public function setQuestionAnswer( qp_StubQuestion $question ) {
+       public function applyQuestion( qp_StubQuestion $question ) {
+               $this->question_id = $question->mQuestionId;
+               $this->type = $question->mType;
+               $this->CommonQuestion = $question->mCommonQuestion;
+               $this->Categories = $question->mCategories;
+               $this->CategorySpans = $question->mCategorySpans;
+               $this->ProposalText = $question->mProposalText;
+               $this->ProposalNames = $question->mProposalNames;
                $this->ProposalCategoryId = $question->mProposalCategoryId;
                $this->ProposalCategoryText = $question->mProposalCategoryText;
        }

Modified: trunk/extensions/QPoll/qp_user.php
===================================================================
--- trunk/extensions/QPoll/qp_user.php  2011-11-17 10:33:20 UTC (rev 103451)
+++ trunk/extensions/QPoll/qp_user.php  2011-11-17 10:49:14 UTC (rev 103452)
@@ -299,7 +299,7 @@
        /**
         * Autoload classes from the map provided
         */
-       static function autoLoad( $map ) {
+       static function autoLoad( array $map ) {
                global $wgAutoloadClasses;
                foreach ( $map as $path => &$classes ) {
                        if ( is_array( $classes ) ) {
@@ -517,7 +517,7 @@
         * @return   array  key is attribute regexp
         *                  value is the value of attribute or null
         */
-       static function getXmlLikeAttributes( $attr_str, $attr_list ) {
+       static function getXmlLikeAttributes( $attr_str, array $attr_list ) {
                $attr_vals = array();
                $match = array();
                foreach ( $attr_list as $attr_name ) {
@@ -551,8 +551,9 @@
        }
 
        static function onLanguageGetMagic( &$magicWords, $langCode ) {
-               foreach ( self::ParserFunctionsWords( $langCode ) as $word => 
$trans )
-                       $magicWords [$word ] = $trans;
+               foreach ( self::ParserFunctionsWords( $langCode ) as $word => 
$trans ) {
+                       $magicWords[$word] = $trans;
+               }
                return true;
        }
 

Modified: trunk/extensions/QPoll/specials/qp_results.php
===================================================================
--- trunk/extensions/QPoll/specials/qp_results.php      2011-11-17 10:33:20 UTC 
(rev 103451)
+++ trunk/extensions/QPoll/specials/qp_results.php      2011-11-17 10:49:14 UTC 
(rev 103452)
@@ -203,7 +203,7 @@
                        return '';
                }
                $pollStore->loadQuestions();
-               $userName = $pollStore->getUserName( $uid );
+               $userName = qp_PollStore::getUserName( $uid );
                if ( $userName === false ) {
                        return '';
                }
@@ -221,7 +221,7 @@
                $headerTags = $this->getAnswerHeader( $pollStore );
                $output .= qp_Renderer::renderTagArray( $headerTags );
                unset( $headerTags );
-               foreach ( $pollStore->Questions as &$qdata ) {
+               foreach ( $pollStore->Questions as $qdata ) {
                        if ( $pollStore->isUsedQuestion( $qdata->question_id ) 
) {
                                $output .= "<br />\n<b>" . $qdata->question_id 
. ".</b> " . qp_Setup::entities( $qdata->CommonQuestion ) . "<br />\n";
                                $qview = $qdata->getView();
@@ -251,7 +251,7 @@
                                $output .= $this->qpLink( $this->getTitle(), 
wfMsg( 'qp_export_to_xls' ), array( "style" => "font-weight:bold;" ), array( 
'action' => 'stats_xls', 'id' => $pid ) ) . "<br />\n";
                                $output .= $this->qpLink( $this->getTitle(), 
wfMsg( 'qp_voices_to_xls' ), array( "style" => "font-weight:bold;" ), array( 
'action' => 'voices_xls', 'id' => $pid ) ) . "<br />\n";
                                $output .= $this->qpLink( $this->getTitle(), 
wfMsg( 'qp_interpretation_results_to_xls' ), array( "style" => 
"font-weight:bold;" ), array( 'action' => 'interpretation_xls', 'id' => $pid ) 
) . "<br />\n";
-                               foreach ( $pollStore->Questions as &$qdata ) {
+                               foreach ( $pollStore->Questions as $qdata ) {
                                        $qview = $qdata->getView();
                                        $output .= 
$qview->displayQuestionStats( $this, $pid );
                                }
@@ -415,9 +415,7 @@
 
        function getPageHeader() {
                global $wgLang, $wgContLang;
-               # fake pollStore to get username by uid: avoid to use this 
trick as much as possible
-               $pollStore = new qp_PollStore();
-               $userName = $pollStore->getUserName( $this->uid );
+               $userName = qp_PollStore::getUserName( $this->uid );
                $db = wfGetDB( DB_SLAVE );
                $res = $db->select(
                        'qp_users_polls',
@@ -654,24 +652,24 @@
                                # 'parentheses' are unavailable in MW 1.14.x
                                $head[] = wfMsg( 'qp_parentheses',  $goto_link 
) . '<br />';
                                $ques_found = false;
-                               foreach ( $pollStore->Questions as &$ques ) {
-                                       if ( $ques->question_id == 
$this->question_id ) {
+                               foreach ( $pollStore->Questions as $qdata ) {
+                                       if ( $qdata->question_id == 
$this->question_id ) {
                                                $ques_found = true;
                                                break;
                                        }
                                }
                                if ( $ques_found ) {
-                                       $qpa = wfMsg( 'qp_header_line_qucl', 
$this->question_id, qp_Setup::entities( $ques->CommonQuestion ) );
-                                       if ( array_key_exists( $this->cat_id, 
$ques->Categories ) ) {
-                                               $categ = &$ques->Categories[ 
$this->cat_id ];
-                                               $proptext = 
$ques->ProposalText[ $this->proposal_id ];
+                                       $qpa = wfMsg( 'qp_header_line_qucl', 
$this->question_id, qp_Setup::entities( $qdata->CommonQuestion ) );
+                                       if ( array_key_exists( $this->cat_id, 
$qdata->Categories ) ) {
+                                               $categ = &$qdata->Categories[ 
$this->cat_id ];
+                                               $proptext = 
$qdata->ProposalText[ $this->proposal_id ];
                                                $cat_name = $categ['name'];
                                                if ( array_key_exists( 
'spanId', $categ ) ) {
-                                                       $cat_name =  wfMsg( 
'qp_full_category_name', $cat_name, $ques->CategorySpans[ $categ['spanId'] 
]['name'] );
+                                                       $cat_name =  wfMsg( 
'qp_full_category_name', $cat_name, $qdata->CategorySpans[ $categ['spanId'] 
]['name'] );
                                                }
                                                $qpa = wfMsg( 
'qp_header_line_qucl',
                                                        $this->question_id,
-                                                       qp_Setup::entities( 
$ques->CommonQuestion ),
+                                                       qp_Setup::entities( 
$qdata->CommonQuestion ),
                                                        qp_Setup::entities( 
$proptext ),
                                                        qp_Setup::entities( 
$cat_name ) ) . '<br />';
                                                $head[] = array( '__tag' => 
'div', 'class' => 'head', 'style' => 'padding-left:2em;', 0 => $qpa );

Modified: trunk/extensions/QPoll/specials/qp_special.php
===================================================================
--- trunk/extensions/QPoll/specials/qp_special.php      2011-11-17 10:33:20 UTC 
(rev 103451)
+++ trunk/extensions/QPoll/specials/qp_special.php      2011-11-17 10:49:14 UTC 
(rev 103452)
@@ -51,7 +51,12 @@
                parent::__construct( $name, $restriction, $listed, $function, 
$file, $includable );
        }
 
-       function qpLink( $target, $text = null, $customAttribs = array(), 
$query = array(), $options = array() ) {
+       function qpLink(
+                       $target,
+                       $text = null,
+                       array $customAttribs = array(),
+                       array $query = array(),
+                       array $options = array() ) {
                return self::$linker->link( $target, $text, $customAttribs, 
$query, $options );
        }
 

Modified: 
trunk/extensions/QPoll/view/proposal/qp_tabularquestionproposalview.php
===================================================================
--- trunk/extensions/QPoll/view/proposal/qp_tabularquestionproposalview.php     
2011-11-17 10:33:20 UTC (rev 103451)
+++ trunk/extensions/QPoll/view/proposal/qp_tabularquestionproposalview.php     
2011-11-17 10:49:14 UTC (rev 103452)
@@ -185,7 +185,7 @@
         * @return  boolean true when at least one category was found in the 
list
         *          false otherwise
         */
-       function applyInterpErrors( $prop_desc ) {
+       function applyInterpErrors( array $prop_desc ) {
                $foundCats = false;
                # scan the category views row to highlight erroneous categories
                foreach ( $this->row as $cat_id => &$cat_tag ) {

Modified: trunk/extensions/QPoll/view/proposal/qp_textquestionproposalview.php
===================================================================
--- trunk/extensions/QPoll/view/proposal/qp_textquestionproposalview.php        
2011-11-17 10:33:20 UTC (rev 103451)
+++ trunk/extensions/QPoll/view/proposal/qp_textquestionproposalview.php        
2011-11-17 10:49:14 UTC (rev 103452)
@@ -126,7 +126,7 @@
         * @return  boolean true when at least one category was found in the 
list
         *          false otherwise
         */
-       function applyInterpErrors( $prop_desc ) {
+       function applyInterpErrors( array $prop_desc ) {
                $foundCats = false;
                $cat_id = -1;
                foreach ( $this->viewtokens as &$token ) {

Modified: trunk/extensions/QPoll/view/qp_abstractview.php
===================================================================
--- trunk/extensions/QPoll/view/qp_abstractview.php     2011-11-17 10:33:20 UTC 
(rev 103451)
+++ trunk/extensions/QPoll/view/qp_abstractview.php     2011-11-17 10:49:14 UTC 
(rev 103452)
@@ -60,9 +60,9 @@
         * @param  $parser   instance of parser for current tag hook
         * @param  $ppframe  instance of ppframe for current tag hook
         */
-       function __construct( &$parser, &$frame ) {
-               $this->parser = &$parser;
-               $this->ppframe = &$frame;
+       function __construct( Parser $parser, PPFrame $frame ) {
+               $this->parser = $parser;
+               $this->ppframe = $frame;
                $this->linker = new Linker();
        }
 
@@ -84,7 +84,12 @@
                $this->ctrl = $ctrl;
        }
 
-       function link( $target, $text = null, $customAttribs = array(), $query 
= array(), $options = array() ) {
+       function link(
+                       $target,
+                       $text = null,
+                       array $customAttribs = array(),
+                       array $query = array(),
+                       array $options = array() ) {
                return $this->linker->link( $target, $text, $customAttribs, 
$query, $options );
        }
 

Modified: trunk/extensions/QPoll/view/qp_interpresultview.php
===================================================================
--- trunk/extensions/QPoll/view/qp_interpresultview.php 2011-11-17 10:33:20 UTC 
(rev 103451)
+++ trunk/extensions/QPoll/view/qp_interpresultview.php 2011-11-17 10:49:14 UTC 
(rev 103452)
@@ -53,7 +53,7 @@
        /**
         * Add interpretation results to tagarray of poll view
         */
-       function showInterpResults( &$tagarray, qp_InterpResult $ctrl, 
$showDescriptions = false ) {
+       function showInterpResults( array &$tagarray, qp_InterpResult $ctrl, 
$showDescriptions = false ) {
                if ( $ctrl->hasVisibleProperties() ) {
                        return;
                }
@@ -92,7 +92,7 @@
                        foreach ( $strucTable as &$line ) {
                                if ( isset( $line['keys'] ) ) {
                                        # current node is associative array
-                                       qp_Renderer::addRow( $rows, 
$line['keys'], '', 'th' );
+                                       qp_Renderer::addRow( $rows, 
$line['keys'], array(), 'th' );
                                        qp_Renderer::addRow( $rows, 
$line['vals'] );
                                } else {
                                        # current node is scalar value

Modified: trunk/extensions/QPoll/view/question/qp_stubquestionview.php
===================================================================
--- trunk/extensions/QPoll/view/question/qp_stubquestionview.php        
2011-11-17 10:33:20 UTC (rev 103451)
+++ trunk/extensions/QPoll/view/question/qp_stubquestionview.php        
2011-11-17 10:49:14 UTC (rev 103452)
@@ -61,7 +61,7 @@
         * @param $parser
         * @param $frame
         */
-       function __construct( &$parser, &$frame ) {
+       function __construct( Parser $parser, PPFrame $frame ) {
                parent::__construct( $parser, $frame );
        }
 
@@ -104,7 +104,7 @@
         * @param $className       CSS class name of row
         * @param $attribute_maps  translation of source attributes into html 
attributes (see qp_Renderer class)
         */
-       function addHeaderRow( $row, $className, $attribute_maps = null ) {
+       function addHeaderRow( $row, $className, array $attribute_maps = 
array() ) {
                $this->hviews[] = (object) array(
                        'row' => $row,
                        'className' => $className,
@@ -126,11 +126,11 @@
                $questionTable = array();
                # add header views to $questionTable
                foreach ( $this->hviews as $header ) {
-                       $rowattrs = '';
-                       $attribute_maps = null;
+                       $rowattrs = array();
+                       $attribute_maps = array();
                        if ( is_object( $header ) ) {
                                $row = &$header->row;
-                               $rowattrs = array( 'class' => 
$header->className );
+                               $rowattrs['class'] = $header->className;
                                $attribute_maps = &$header->attribute_maps;
                        } else {
                                $row = &$header;

Modified: trunk/extensions/QPoll/view/question/qp_tabularquestionview.php
===================================================================
--- trunk/extensions/QPoll/view/question/qp_tabularquestionview.php     
2011-11-17 10:33:20 UTC (rev 103451)
+++ trunk/extensions/QPoll/view/question/qp_tabularquestionview.php     
2011-11-17 10:49:14 UTC (rev 103452)
@@ -68,7 +68,7 @@
         * @param $frame
         * @param  $showResults     poll's showResults (may be overriden in the 
question)
         */
-       function __construct( &$parser, &$frame, $showResults ) {
+       function __construct( Parser $parser, PPFrame $frame, $showResults ) {
                parent::__construct( $parser, $frame );
                $this->pollShowResults = $showResults;
        }
@@ -143,7 +143,7 @@
         * Builds tagarray of categories
         * @param     $categories  "raw" categories
         */
-       function buildCategoriesRow( $categories ) {
+       function buildCategoriesRow( array $categories ) {
                $row = array();
                if ( $this->proposalsFirst ) {
                        // add empty <th> at the begin of row to "compensate" 
proposal text
@@ -163,7 +163,7 @@
         * Builds tagarray of category spans
         * @param   $categorySpans  "raw" spans
         */
-       function buildSpansRow( $categorySpans ) {
+       function buildSpansRow( array $categorySpans ) {
                $row = array();
                if ( $this->proposalsFirst ) {
                        // add empty <th> at the begin of row to "compensate" 
proposal text
@@ -238,7 +238,7 @@
                        }
                        if ( isset( $this->pviews[$prop_id] ) ) {
                                # the whole proposal line has errors
-                               $propview = &$this->pviews[$prop_id];
+                               $propview = $this->pviews[$prop_id];
                                if ( !is_array( $prop_desc ) ) {
                                        if ( !is_string( $prop_desc ) ) {
                                                $prop_desc = wfMsg( 
'qp_interpetation_wrong_answer' );
@@ -267,11 +267,11 @@
                $questionTable = array();
                # add header views to $questionTable
                foreach ( $this->hviews as $header ) {
-                       $rowattrs = '';
-                       $attribute_maps = null;
+                       $rowattrs = array();
+                       $attribute_maps = array();
                        if ( is_object( $header ) ) {
                                $row = &$header->row;
-                               $rowattrs = array( 'class' => 
$header->className );
+                               $rowattrs['class'] = $header->className;
                                $attribute_maps = &$header->attribute_maps;
                        } else {
                                $row = &$header;

Modified: trunk/extensions/QPoll/view/question/qp_textquestionview.php
===================================================================
--- trunk/extensions/QPoll/view/question/qp_textquestionview.php        
2011-11-17 10:33:20 UTC (rev 103451)
+++ trunk/extensions/QPoll/view/question/qp_textquestionview.php        
2011-11-17 10:49:14 UTC (rev 103452)
@@ -79,7 +79,7 @@
        /**
         * Add proposal error tagarray
         */
-       function addError( $elem ) {
+       function addError( stdClass $elem ) {
                $this->cell[] = array(
                        '__tag' => 'span',
                        'class' => 'proposalerror',
@@ -90,7 +90,7 @@
        /**
         * Add category as input type text / checkbox / radio / textarea 
tagarray
         */
-       function addInput( $elem, $className ) {
+       function addInput( stdClass $elem, $className ) {
                $tagName = ( $elem->type === 'text' && 
$elem->attributes['height'] !== 0 ) ? 'textarea' : 'input';
                $lines_count = 1;
                # get category value
@@ -153,7 +153,7 @@
        /**
         * Add category as select / option list tagarray
         */
-       function addSelect( $elem, $className ) {
+       function addSelect( stdClass $elem, $className ) {
                if ( $elem->options[0] !== '' ) {
                        # default element in select/option set always must be 
an empty option
                        array_unshift( $elem->options, '' );
@@ -209,7 +209,7 @@
        /**
         * Add tagarray representation of proposal part
         */
-       function addProposalPart( $elem ) {
+       function addProposalPart( /* string */ $elem ) {
                $this->cell[] = array(
                        '__tag' => 'span',
                        'class' => 'prop_part',
@@ -268,7 +268,7 @@
         * @param $frame
         * @param  $showResults     poll's showResults (may be overriden in the 
question)
         */
-       function __construct( &$parser, &$frame, $showResults ) {
+       function __construct( Parser $parser, PPFrame $frame, $showResults ) {
                parent::__construct( $parser, $frame );
                $this->vr = new qp_TextQuestionViewRow( $this );
                /* todo: implement showResults */
@@ -319,7 +319,7 @@
                        }
                        if ( isset( $this->pviews[$prop_id] ) ) {
                                # the whole proposal line has errors
-                               $propview = &$this->pviews[$prop_id];
+                               $propview = $this->pviews[$prop_id];
                                if ( !is_array( $prop_desc ) ) {
                                        if ( !is_string( $prop_desc ) ) {
                                                $prop_desc = wfMsg( 
'qp_interpetation_wrong_answer' );
@@ -350,7 +350,7 @@
         * @param   $viewtokens  array of viewtokens
         * @return  tagarray
         */
-       function renderParsedProposal( $pkey, &$viewtokens ) {
+       function renderParsedProposal( $pkey, array &$viewtokens ) {
                $vr = $this->vr;
                # proposal prefix for category tag id generation
                $vr->reset( 
"tx{$this->ctrl->poll->mOrderId}q{$this->ctrl->mQuestionId}p{$pkey}" );
@@ -411,18 +411,18 @@
                $questionTable = array();
                # add header views to $questionTable
                foreach ( $this->hviews as $header ) {
-                       $rowattrs = '';
-                       $attribute_maps = null;
+                       $rowattrs = array();
+                       $attribute_maps = array();
                        if ( is_object( $header ) ) {
                                $row = &$header->row;
-                               $rowattrs = array( 'class' => 
$header->className );
+                               $rowattrs['class'] = $header->className;
                                $attribute_maps = &$header->attribute_maps;
                        } else {
                                $row = &$header;
                        }
                        qp_Renderer::addRow( $questionTable, $row, $rowattrs, 
'th', $attribute_maps );
                }
-               foreach ( $this->pviews as $pkey => &$propview ) {
+               foreach ( $this->pviews as $pkey => $propview ) {
                        $prop = $this->renderParsedProposal( $pkey, 
$propview->viewtokens );
                        $rowattrs = array( 'class' => $propview->rowClass );
                        if ( $this->transposed ) {

Modified: trunk/extensions/QPoll/view/results/qp_questiondataresults.php
===================================================================
--- trunk/extensions/QPoll/view/results/qp_questiondataresults.php      
2011-11-17 10:33:20 UTC (rev 103451)
+++ trunk/extensions/QPoll/view/results/qp_questiondataresults.php      
2011-11-17 10:49:14 UTC (rev 103452)
@@ -22,7 +22,7 @@
                $this->ctrl = $ctrl;
        }
 
-       protected function categoryentities( $cat ) {
+       protected function categoryentities( array $cat ) {
                $cat['name'] = qp_Setup::entities( $cat['name'] );
                return $cat;
        }
@@ -33,8 +33,18 @@
        function displayUserQuestionVote() {
                $ctrl = $this->ctrl;
                $output = "<div class=\"qpoll\">\n" . "<table 
class=\"qdata\">\n";
-               $output .= qp_Renderer::displayRow( array_map( array( $this, 
'categoryentities' ), $ctrl->CategorySpans ), array( 'class' => 'spans' ), 
'th', array( 'count' => 'colspan', 'name' => 0 ) );
-               $output .= qp_Renderer::displayRow( array_map( array( $this, 
'categoryentities' ), $ctrl->Categories ), '', 'th', array( 'name' => 0 ) );
+               $output .= qp_Renderer::displayRow(
+                       array_map( array( $this, 'categoryentities' ), 
$ctrl->CategorySpans ),
+                       array( 'class' => 'spans' ),
+                       'th',
+                       array( 'count' => 'colspan', 'name' => 0 )
+               );
+               $output .= qp_Renderer::displayRow(
+                       array_map( array( $this, 'categoryentities' ), 
$ctrl->Categories ),
+                       array(),
+                       'th',
+                       array( 'name' => 0 )
+               );
                # multiple choice polls doesn't use real spans, instead, every 
column is like "span"
                $spansUsed = count( $ctrl->CategorySpans ) > 0 || $ctrl->type 
== "multipleChoice";
                foreach ( $ctrl->ProposalText as $propkey => &$proposal_text ) {
@@ -80,8 +90,18 @@
                $current_title = $page->getTitle();
                $output = "<br />\n<b>" . $ctrl->question_id . ".</b> " . 
qp_Setup::entities( $ctrl->CommonQuestion ) . "<br />\n";
                $output .= "<div class=\"qpoll\">\n" . "<table 
class=\"qdata\">\n";
-               $output .= qp_Renderer::displayRow( array_map( array( $this, 
'categoryentities' ), $ctrl->CategorySpans ), array( 'class' => 'spans' ), 
'th', array( 'count' => 'colspan', 'name' => 0 ) );
-               $output .= qp_Renderer::displayRow( array_map( array( $this, 
'categoryentities' ), $ctrl->Categories ), '', 'th', array( 'name' => 0 ) );
+               $output .= qp_Renderer::displayRow(
+                       array_map( array( $this, 'categoryentities' ), 
$ctrl->CategorySpans ),
+                       array( 'class' => 'spans' ),
+                       'th',
+                       array( 'count' => 'colspan', 'name' => 0 )
+               );
+               $output .= qp_Renderer::displayRow(
+                       array_map( array( $this, 'categoryentities' ), 
$ctrl->Categories ),
+                       array(),
+                       'th',
+                       array( 'name' => 0 )
+               );
                # multiple choice polls doesn't use real spans, instead, every 
column is like "span"
                $spansUsed = count( $ctrl->CategorySpans ) > 0 || $ctrl->type 
== "multipleChoice";
                foreach ( $ctrl->ProposalText as $propkey => &$proposal_text ) {

Modified: trunk/extensions/QPoll/view/results/qp_textquestiondataresults.php
===================================================================
--- trunk/extensions/QPoll/view/results/qp_textquestiondataresults.php  
2011-11-17 10:33:20 UTC (rev 103451)
+++ trunk/extensions/QPoll/view/results/qp_textquestiondataresults.php  
2011-11-17 10:49:14 UTC (rev 103452)
@@ -100,7 +100,10 @@
                                        throw new MWException( 'DB token has 
invalid type (' . gettype( $token ) . ') in ' . __METHOD__ );
                                }
                        }
-                       $output .= qp_Renderer::displayRow( array( $row ), 
array( 'class' => 'qdatatext' ) );
+                       $output .= qp_Renderer::displayRow(
+                               array( $row ),
+                               array( 'class' => 'qdatatext' )
+                       );
                }
                $output .= "</table>\n" . "</div>\n";
                return $output;

Modified: trunk/extensions/QPoll/view/xls/qp_xlspoll.php
===================================================================
--- trunk/extensions/QPoll/view/xls/qp_xlspoll.php      2011-11-17 10:33:20 UTC 
(rev 103451)
+++ trunk/extensions/QPoll/view/xls/qp_xlspoll.php      2011-11-17 10:49:14 UTC 
(rev 103452)
@@ -68,7 +68,7 @@
        function voicesToXls( qp_PollStore $pollStore ) {
                $pollStore->loadQuestions();
                $first_question = true;
-               foreach ( $pollStore->Questions as $qkey => &$qdata ) {
+               foreach ( $pollStore->Questions as $qkey => $qdata ) {
                        $xlsq = ( $qdata->type === 'textQuestion' ) ? 
$this->text_writer : $this->tabular_writer;
                        $xlsq->setQuestionData( $qdata );
                        if ( $first_question ) {
@@ -115,7 +115,7 @@
                $pollStore->loadTotals();
                $pollStore->calculateStatistics();
                $first_question = true;
-               foreach ( $pollStore->Questions as $qkey => &$qdata ) {
+               foreach ( $pollStore->Questions as $qkey => $qdata ) {
                        $xlsq = ( $qdata->type === 'textQuestion' ) ? 
$this->text_writer : $this->tabular_writer;
                        $xlsq->setQuestionData( $qdata );
                        if ( $first_question ) {

Modified: trunk/extensions/QPoll/view/xls/qp_xlstabularquestion.php
===================================================================
--- trunk/extensions/QPoll/view/xls/qp_xlstabularquestion.php   2011-11-17 
10:33:20 UTC (rev 103451)
+++ trunk/extensions/QPoll/view/xls/qp_xlstabularquestion.php   2011-11-17 
10:49:14 UTC (rev 103452)
@@ -31,7 +31,7 @@
                $this->writeRowLn( 0, $row );
        }
 
-       function writeQuestionVoice( $pvoices ) {
+       function writeQuestionVoice( array $pvoices ) {
                $qdata = $this->qdata;
                # create square table of proposal / category answers for each 
uid in uvoices array
                $voicesTable = array();

Modified: trunk/extensions/QPoll/view/xls/qp_xlstextquestion.php
===================================================================
--- trunk/extensions/QPoll/view/xls/qp_xlstextquestion.php      2011-11-17 
10:33:20 UTC (rev 103451)
+++ trunk/extensions/QPoll/view/xls/qp_xlstextquestion.php      2011-11-17 
10:49:14 UTC (rev 103452)
@@ -11,7 +11,7 @@
                ) );
        }
 
-       function writeQuestionVoice( $pvoices ) {
+       function writeQuestionVoice( array $pvoices ) {
                $qdata = $this->qdata;
                foreach ( $qdata->ProposalText as $propkey => 
&$serialized_tokens ) {
                        # Create 2D-table of proposal / category answers for 
each uid in uvoices array


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

Reply via email to