r94306 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r94305‎ | r94306 | r94307 >
Date:23:57, 11 August 2011
Author:reedy
Status:ok
Tags:
Comment:
Whitespace
Modified paths:
  • /trunk/extensions/LocalisationUpdate/LocalisationUpdate.class.php (modified) (history)
  • /trunk/extensions/LocalisationUpdate/QuickArrayReader.php (modified) (history)

Diff [purge]

Index: trunk/extensions/LocalisationUpdate/QuickArrayReader.php
@@ -9,7 +9,7 @@
1010 */
1111 class QuickArrayReader {
1212 var $vars = array();
13 -
 13+
1414 function __construct( $string ) {
1515 $scalarTypes = array(
1616 T_LNUMBER => true,
@@ -36,30 +36,30 @@
3737 // '$messages' -> 'messages'
3838 $varname = trim( substr( $tokens[$i][1], 1 ) );
3939 $varindex = null;
40 -
 40+
4141 while( isset($skipTypes[$tokens[++$i][0]] ) );
42 -
 42+
4343 if( $tokens[$i] === '[' ) {
4444 while( isset($skipTypes[$tokens[++$i][0]] ) );
45 -
 45+
4646 if( isset($scalarTypes[$tokens[$i][0]] ) ) {
4747 $varindex = $this->parseScalar( $tokens[$i] );
4848 } else {
4949 throw $this->except( $tokens[$i], 'scalar index' );
5050 }
5151 while( isset($skipTypes[$tokens[++$i][0]] ) );
52 -
 52+
5353 if( $tokens[$i] !== ']' ) {
5454 throw $this->except( $tokens[$i], ']' );
5555 }
5656 while( isset($skipTypes[$tokens[++$i][0]] ) );
5757 }
58 -
 58+
5959 if( $tokens[$i] !== '=' ) {
6060 throw $this->except( $tokens[$i], '=' );
6161 }
6262 while( isset($skipTypes[$tokens[++$i][0]] ) );
63 -
 63+
6464 if( isset($scalarTypes[$tokens[$i][0]] ) ) {
6565 $buildval = $this->parseScalar( $tokens[$i] );
6666 } elseif( $tokens[$i][0] === T_ARRAY ) {
@@ -70,7 +70,7 @@
7171 $buildval = array();
7272 do {
7373 while( isset($skipTypes[$tokens[++$i][0]] ) );
74 -
 74+
7575 if( $tokens[$i] === ')' ) {
7676 break;
7777 }
@@ -78,18 +78,18 @@
7979 $key = $this->parseScalar( $tokens[$i] );
8080 }
8181 while( isset($skipTypes[$tokens[++$i][0]] ) );
82 -
 82+
8383 if( $tokens[$i][0] !== T_DOUBLE_ARROW ) {
8484 throw $this->except( $tokens[$i], '=>' );
8585 }
8686 while( isset($skipTypes[$tokens[++$i][0]] ) );
87 -
 87+
8888 if( isset($scalarTypes[$tokens[$i][0]] ) ) {
8989 $val = $this->parseScalar( $tokens[$i] );
9090 }
9191 @$buildval[$key] = $val;
9292 while( isset($skipTypes[$tokens[++$i][0]] ) );
93 -
 93+
9494 if( $tokens[$i] === ',' ) {
9595 continue;
9696 } elseif( $tokens[$i] === ')' ) {
@@ -117,7 +117,7 @@
118118 }
119119 }
120120 }
121 -
 121+
122122 private function except( $got, $expected ) {
123123 if( is_array( $got ) ) {
124124 $got = token_name( $got[0] ) . " ('" . $got[1] . "')";
@@ -160,7 +160,7 @@
161161 // be useful for a change
162162 return $str;
163163 }
164 -
 164+
165165 function getVar( $varname ) {
166166 if( isset( $this->vars[$varname] ) ) {
167167 return $this->vars[$varname];
Index: trunk/extensions/LocalisationUpdate/LocalisationUpdate.class.php
@@ -124,7 +124,7 @@
125125 }
126126
127127 /**
128 - * Update the Mediawiki Core Messages.
 128+ * Update the MediaWiki Core Messages.
129129 *
130130 * @param $verbose Boolean
131131 *
@@ -179,7 +179,7 @@
180180 }
181181
182182 // Log some nice info.
183 - self::myLog( "{$changedCount} Mediawiki messages are updated" );
 183+ self::myLog( "{$changedCount} MediaWiki messages are updated" );
184184
185185 return $changedCount;
186186 }
@@ -606,6 +606,11 @@
607607 }
608608 }
609609
 610+ /**
 611+ * @param $php
 612+ * @param $varname
 613+ * @return bool|array
 614+ */
610615 public static function parsePHP( $php, $varname ) {
611616 try {
612617 $reader = new QuickArrayReader("<?php $php");

Status & tagging log