Merge "fix some spacing"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Sun, 27 Jan 2013 13:14:56 +0000 (13:14 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Sun, 27 Jan 2013 13:14:56 +0000 (13:14 +0000)
1  2 
includes/api/ApiBase.php
includes/diff/DairikiDiff.php
includes/parser/Parser.php

diff --combined includes/api/ApiBase.php
@@@ -105,7 -105,7 +105,7 @@@ abstract class ApiBase extends ContextS
         * The result data should be stored in the ApiResult object available
         * through getResult().
         */
 -      public abstract function execute();
 +      abstract public function execute();
  
        /**
         * Returns a string that identifies the version of the extending class.
                        array( $this, "parameterNotEmpty" ) ) ), $required );
  
                if ( count( $intersection ) > 1 ) {
-                       $this->dieUsage( "The parameters {$p}" . implode( ", {$p}",  $intersection ) . ' can not be used together', "{$p}invalidparammix" );
+                       $this->dieUsage( "The parameters {$p}" . implode( ", {$p}", $intersection ) . ' can not be used together', "{$p}invalidparammix" );
                } elseif ( count( $intersection ) == 0 ) {
                        $this->dieUsage( "One of the parameters {$p}" . implode( ", {$p}", $required ) . ' is required', "{$p}missingparam" );
                }
  
                // Check whether the error array was nested
                // array( array( <code>, <params> ), array( <another_code>, <params> ) )
-               if( is_array( $key ) ){
+               if( is_array( $key ) ) {
                        $error = $key;
                        $key = array_shift( $error );
                }
@@@ -43,14 -43,14 +43,14 @@@ class _DiffOp 
         * @return int
         */
        function norig() {
 -              return $this->orig ? sizeof( $this->orig ) : 0;
 +              return $this->orig ? count( $this->orig ) : 0;
        }
  
        /**
         * @return int
         */
        function nclosing() {
 -              return $this->closing ? sizeof( $this->closing ) : 0;
 +              return $this->closing ? count( $this->closing ) : 0;
        }
  }
  
@@@ -194,8 -194,8 +194,8 @@@ class _DiffEngine 
                $this->_shift_boundaries( $to_lines, $this->ychanged, $this->xchanged );
  
                // Compute the edit operations.
 -              $n_from = sizeof( $from_lines );
 -              $n_to = sizeof( $to_lines );
 +              $n_from = count( $from_lines );
 +              $n_to = count( $to_lines );
  
                $edits = array();
                $xi = $yi = 0;
                        }
  
                        $add = array();
-                       while ( $yi < $n_to && $this->ychanged[$yi] )  {
+                       while ( $yi < $n_to && $this->ychanged[$yi] ) {
                                $add[] = $to_lines[$yi++];
                        }
  
                        unset( $wikidiff3 );
                } else {
                        // old diff
 -                      $n_from = sizeof( $from_lines );
 -                      $n_to = sizeof( $to_lines );
 +                      $n_from = count( $from_lines );
 +                      $n_to = count( $to_lines );
                        $this->xchanged = $this->ychanged = array();
                        $this->xv = $this->yv = array();
                        $this->xind = $this->yind = array();
                        }
  
                        // Find the LCS.
 -                      $this->_compareseq( 0, sizeof( $this->xv ), 0, sizeof( $this->yv ) );
 +                      $this->_compareseq( 0, count( $this->xv ), 0, count( $this->yv ) );
                }
                wfProfileOut( __METHOD__ );
        }
                $i = 0;
                $j = 0;
  
 -              assert( 'sizeof($lines) == sizeof($changed)' );
 -              $len = sizeof( $lines );
 -              $other_len = sizeof( $other_changed );
 +              assert( 'count($lines) == count($changed)' );
 +              $len = count( $lines );
 +              $other_len = count( $other_changed );
  
                while ( 1 ) {
                        /*
@@@ -713,7 -713,7 +713,7 @@@ class Diff 
                $lcs = 0;
                foreach ( $this->edits as $edit ) {
                        if ( $edit->type == 'copy' ) {
 -                              $lcs += sizeof( $edit->orig );
 +                              $lcs += count( $edit->orig );
                        }
                }
                return $lcs;
  
                foreach ( $this->edits as $edit ) {
                        if ( $edit->orig ) {
 -                              array_splice( $lines, sizeof( $lines ), 0, $edit->orig );
 +                              array_splice( $lines, count( $lines ), 0, $edit->orig );
                        }
                }
                return $lines;
  
                foreach ( $this->edits as $edit ) {
                        if ( $edit->closing ) {
 -                              array_splice( $lines, sizeof( $lines ), 0, $edit->closing );
 +                              array_splice( $lines, count( $lines ), 0, $edit->closing );
                        }
                }
                return $lines;
@@@ -829,23 -829,23 +829,23 @@@ class MappedDiff extends Diff 
                $mapped_from_lines, $mapped_to_lines ) {
                wfProfileIn( __METHOD__ );
  
 -              assert( 'sizeof( $from_lines ) == sizeof( $mapped_from_lines )' );
 -              assert( 'sizeof( $to_lines ) == sizeof( $mapped_to_lines )' );
 +              assert( 'count( $from_lines ) == count( $mapped_from_lines )' );
 +              assert( 'count( $to_lines ) == count( $mapped_to_lines )' );
  
                parent::__construct( $mapped_from_lines, $mapped_to_lines );
  
                $xi = $yi = 0;
 -              for ( $i = 0; $i < sizeof( $this->edits ); $i++ ) {
 +              for ( $i = 0; $i < count( $this->edits ); $i++ ) {
                        $orig = &$this->edits[$i]->orig;
                        if ( is_array( $orig ) ) {
 -                              $orig = array_slice( $from_lines, $xi, sizeof( $orig ) );
 -                              $xi += sizeof( $orig );
 +                              $orig = array_slice( $from_lines, $xi, count( $orig ) );
 +                              $xi += count( $orig );
                        }
  
                        $closing = &$this->edits[$i]->closing;
                        if ( is_array( $closing ) ) {
 -                              $closing = array_slice( $to_lines, $yi, sizeof( $closing ) );
 -                              $yi += sizeof( $closing );
 +                              $closing = array_slice( $to_lines, $yi, count( $closing ) );
 +                              $yi += count( $closing );
                        }
                }
                wfProfileOut( __METHOD__ );
@@@ -900,7 -900,7 +900,7 @@@ class DiffFormatter 
                foreach ( $diff->edits as $edit ) {
                        if ( $edit->type == 'copy' ) {
                                if ( is_array( $block ) ) {
 -                                      if ( sizeof( $edit->orig ) <= $nlead + $ntrail ) {
 +                                      if ( count( $edit->orig ) <= $nlead + $ntrail ) {
                                                $block[] = $edit;
                                        } else {
                                                if ( $ntrail ) {
                                $context = $edit->orig;
                        } else {
                                if ( !is_array( $block ) ) {
 -                                      $context = array_slice( $context, sizeof( $context ) - $nlead );
 -                                      $x0 = $xi - sizeof( $context );
 -                                      $y0 = $yi - sizeof( $context );
 +                                      $context = array_slice( $context, count( $context ) - $nlead );
 +                                      $x0 = $xi - count( $context );
 +                                      $y0 = $yi - count( $context );
                                        $block = array();
                                        if ( $context ) {
                                                $block[] = new _DiffOp_Copy( $context );
                        }
  
                        if ( $edit->orig ) {
 -                              $xi += sizeof( $edit->orig );
 +                              $xi += count( $edit->orig );
                        }
                        if ( $edit->closing ) {
 -                              $yi += sizeof( $edit->closing );
 +                              $yi += count( $edit->closing );
                        }
                }
  
@@@ -215,8 -215,8 +215,8 @@@ class Parser 
        public function __construct( $conf = array() ) {
                $this->mConf = $conf;
                $this->mUrlProtocols = wfUrlProtocols();
-               $this->mExtLinkBracketedRegex = '/\[(((?i)' . $this->mUrlProtocols . ')'.
-                       self::EXT_LINK_URL_CLASS.'+)\p{Zs}*([^\]\\x00-\\x08\\x0a-\\x1F]*?)\]/Su';
+               $this->mExtLinkBracketedRegex = '/\[(((?i)' . $this->mUrlProtocols . ')' .
+                       self::EXT_LINK_URL_CLASS . '+)\p{Zs}*([^\]\\x00-\\x08\\x0a-\\x1F]*?)\]/Su';
                if ( isset( $conf['preprocessorClass'] ) ) {
                        $this->mPreprocessorClass = $conf['preprocessorClass'];
                } elseif ( defined( 'MW_COMPILED' ) ) {
                 */
  
                global $wgUseTidy, $wgAlwaysUseTidy;
-               $fname = __METHOD__.'-' . wfGetCaller();
+               $fname = __METHOD__ . '-' . wfGetCaller();
                wfProfileIn( __METHOD__ );
                wfProfileIn( $fname );
  
                                "Preprocessor generated node count: " .
                                        "{$this->mGeneratedPPNodeCount}/{$this->mOptions->getMaxGeneratedPPNodeCount()}\n" .
                                "Post-expand include size: {$this->mIncludeSizes['post-expand']}/$max bytes\n" .
-                               "Template argument size: {$this->mIncludeSizes['arg']}/$max bytes\n".
-                               "Highest expansion depth: {$this->mHighestExpansionDepth}/{$this->mOptions->getMaxPPExpandDepth()}\n".
+                               "Template argument size: {$this->mIncludeSizes['arg']}/$max bytes\n" .
+                               "Highest expansion depth: {$this->mHighestExpansionDepth}/{$this->mOptions->getMaxPPExpandDepth()}\n" .
                                $PFreport;
                        wfRunHooks( 'ParserLimitReport', array( $this, &$limitReport ) );
                        $text .= "\n<!-- \n$limitReport-->\n";
         *
         * @return string
         */
 -      static public function getRandomString() {
 +      public static function getRandomString() {
                return wfRandomString( 16 );
        }
  
                        $line = trim( $outLine );
  
                        if ( $line === '' ) { # empty line, go to next line
-                               $out .= $outLine."\n";
+                               $out .= $outLine . "\n";
                                continue;
                        }
  
                        $first_character = $line[0];
                        $matches = array();
  
-                       if ( preg_match( '/^(:*)\{\|(.*)$/', $line , $matches ) ) {
+                       if ( preg_match( '/^(:*)\{\|(.*)$/', $line, $matches ) ) {
                                # First check if we are starting a new table
                                $indent_level = strlen( $matches[1] );
  
                                $attributes = $this->mStripState->unstripBoth( $matches[2] );
-                               $attributes = Sanitizer::fixTagAttributes( $attributes , 'table' );
-                               $outLine = str_repeat( '<dl><dd>' , $indent_level ) . "<table{$attributes}>";
-                               array_push( $td_history , false );
-                               array_push( $last_tag_history , '' );
-                               array_push( $tr_history , false );
-                               array_push( $tr_attributes , '' );
-                               array_push( $has_opened_tr , false );
+                               $attributes = Sanitizer::fixTagAttributes( $attributes, 'table' );
+                               $outLine = str_repeat( '<dl><dd>', $indent_level ) . "<table{$attributes}>";
+                               array_push( $td_history, false );
+                               array_push( $last_tag_history, '' );
+                               array_push( $tr_history, false );
+                               array_push( $tr_attributes, '' );
+                               array_push( $has_opened_tr, false );
                        } elseif ( count( $td_history ) == 0 ) {
                                # Don't do any of the following
-                               $out .= $outLine."\n";
+                               $out .= $outLine . "\n";
                                continue;
-                       } elseif ( substr( $line , 0 , 2 ) === '|}' ) {
+                       } elseif ( substr( $line, 0, 2 ) === '|}' ) {
                                # We are ending a table
-                               $line = '</table>' . substr( $line , 2 );
+                               $line = '</table>' . substr( $line, 2 );
                                $last_tag = array_pop( $last_tag_history );
  
                                if ( !array_pop( $has_opened_tr ) ) {
                                        $line = "</{$last_tag}>{$line}";
                                }
                                array_pop( $tr_attributes );
-                               $outLine = $line . str_repeat( '</dd></dl>' , $indent_level );
-                       } elseif ( substr( $line , 0 , 2 ) === '|-' ) {
+                               $outLine = $line . str_repeat( '</dd></dl>', $indent_level );
+                       } elseif ( substr( $line, 0, 2 ) === '|-' ) {
                                # Now we have a table row
                                $line = preg_replace( '#^\|-+#', '', $line );
  
                                $line = '';
                                $last_tag = array_pop( $last_tag_history );
                                array_pop( $has_opened_tr );
-                               array_push( $has_opened_tr , true );
+                               array_push( $has_opened_tr, true );
  
                                if ( array_pop( $tr_history ) ) {
                                        $line = '</tr>';
                                }
  
                                $outLine = $line;
-                               array_push( $tr_history , false );
-                               array_push( $td_history , false );
-                               array_push( $last_tag_history , '' );
-                       } elseif ( $first_character === '|' || $first_character === '!' || substr( $line , 0 , 2 )  === '|+' ) {
+                               array_push( $tr_history, false );
+                               array_push( $td_history, false );
+                               array_push( $last_tag_history, '' );
+                       } elseif ( $first_character === '|' || $first_character === '!' || substr( $line, 0, 2 )  === '|+' ) {
                                # This might be cell elements, td, th or captions
-                               if ( substr( $line , 0 , 2 ) === '|+' ) {
+                               if ( substr( $line, 0, 2 ) === '|+' ) {
                                        $first_character = '+';
-                                       $line = substr( $line , 1 );
+                                       $line = substr( $line, 1 );
                                }
  
-                               $line = substr( $line , 1 );
+                               $line = substr( $line, 1 );
  
                                if ( $first_character === '!' ) {
-                                       $line = str_replace( '!!' , '||' , $line );
+                                       $line = str_replace( '!!', '||', $line );
                                }
  
                                # Split up multiple cells on the same line.
                                # FIXME : This can result in improper nesting of tags processed
                                # by earlier parser steps, but should avoid splitting up eg
                                # attribute values containing literal "||".
-                               $cells = StringUtils::explodeMarkup( '||' , $line );
+                               $cells = StringUtils::explodeMarkup( '||', $line );
  
                                $outLine = '';
  
                                                if ( !array_pop( $tr_history ) ) {
                                                        $previous = "<tr{$tr_after}>\n";
                                                }
-                                               array_push( $tr_history , true );
-                                               array_push( $tr_attributes , '' );
+                                               array_push( $tr_history, true );
+                                               array_push( $tr_attributes, '' );
                                                array_pop( $has_opened_tr );
-                                               array_push( $has_opened_tr , true );
+                                               array_push( $has_opened_tr, true );
                                        }
  
                                        $last_tag = array_pop( $last_tag_history );
                                                $last_tag = '';
                                        }
  
-                                       array_push( $last_tag_history , $last_tag );
+                                       array_push( $last_tag_history, $last_tag );
  
                                        # A cell could contain both parameters and data
-                                       $cell_data = explode( '|' , $cell , 2 );
+                                       $cell_data = explode( '|', $cell, 2 );
  
                                        # Bug 553: Note that a '|' inside an invalid link should not
                                        # be mistaken as delimiting cell parameters
                                                $cell = "{$previous}<{$last_tag}>{$cell_data[0]}";
                                        } else {
                                                $attributes = $this->mStripState->unstripBoth( $cell_data[0] );
-                                               $attributes = Sanitizer::fixTagAttributes( $attributes , $last_tag );
+                                               $attributes = Sanitizer::fixTagAttributes( $attributes, $last_tag );
                                                $cell = "{$previous}<{$last_tag}{$attributes}>{$cell_data[1]}";
                                        }
  
                                        $outLine .= $cell;
-                                       array_push( $td_history , true );
+                                       array_push( $td_history, true );
                                }
                        }
                        $out .= $outLine . "\n";
  
                # replaceInternalLinks may sometimes leave behind
                # absolute URLs, which have to be masked to hide them from replaceExternalLinks
-               $text = str_replace( $this->mUniqPrefix.'NOPARSE', '', $text );
+               $text = str_replace( $this->mUniqPrefix . 'NOPARSE', '', $text );
  
                $text = $this->doMagicLinks( $text );
                $text = $this->formatHeadings( $text, $origText, $isMain );
                                $CssClass = 'mw-magiclink-pmid';
                                $id = $m[4];
                        } else {
-                               throw new MWException( __METHOD__.': unrecognised match type "' .
+                               throw new MWException( __METHOD__ . ': unrecognised match type "' .
                                        substr( $m[0], 0, 20 ) . '"' );
                        }
                        $url = wfMessage( $urlmsg, $id )->inContentLanguage()->text();
                wfProfileIn( __METHOD__ );
                for ( $i = 6; $i >= 1; --$i ) {
                        $h = str_repeat( '=', $i );
-                       $text = preg_replace( "/^$h(.+)$h\\s*$/m",
-                         "<h$i>\\1</h$i>", $text );
+                       $text = preg_replace( "/^$h(.+)$h\\s*$/m", "<h$i>\\1</h$i>", $text );
                }
                wfProfileOut( __METHOD__ );
                return $text;
                foreach ( $lines as $line ) {
                        $outtext .= $this->doQuotes( $line ) . "\n";
                }
-               $outtext = substr( $outtext, 0,-1 );
+               $outtext = substr( $outtext, 0, -1 );
                wfProfileOut( __METHOD__ );
                return $outtext;
        }
                                                } elseif ( $state === 'ib' ) {
                                                        $output .= '</b></i><b>'; $state = 'b';
                                                } elseif ( $state === 'both' ) {
-                                                       $output .= '<b><i>'.$buffer.'</i>'; $state = 'b';
+                                                       $output .= '<b><i>' . $buffer . '</i>'; $state = 'b';
                                                } else { # $state can be 'b' or ''
                                                        $output .= '<i>'; $state .= 'i';
                                                }
                                                } elseif ( $state === 'ib' ) {
                                                        $output .= '</b>'; $state = 'i';
                                                } elseif ( $state === 'both' ) {
-                                                       $output .= '<i><b>'.$buffer.'</b>'; $state = 'i';
+                                                       $output .= '<i><b>' . $buffer . '</b>'; $state = 'i';
                                                } else { # $state can be 'i' or ''
                                                        $output .= '<b>'; $state .= 'b';
                                                }
                                                } elseif ( $state === 'ib' ) {
                                                        $output .= '</b></i>'; $state = '';
                                                } elseif ( $state === 'both' ) {
-                                                       $output .= '<i><b>'.$buffer.'</b></i>'; $state = '';
+                                                       $output .= '<i><b>' . $buffer . '</b></i>'; $state = '';
                                                } else { # ($state == '')
                                                        $buffer = ''; $state = 'both';
                                                }
                        }
                        # There might be lonely ''''', so make sure we have a buffer
                        if ( $state === 'both' && $buffer ) {
-                               $output .= '<b><i>'.$buffer.'</i></b>';
+                               $output .= '<b><i>' . $buffer . '</i></b>';
                        }
                        return $output;
                }
        function replaceInternalLinks2( &$s ) {
                wfProfileIn( __METHOD__ );
  
-               wfProfileIn( __METHOD__.'-setup' );
+               wfProfileIn( __METHOD__ . '-setup' );
                static $tc = FALSE, $e1, $e1_img;
                # the % is needed to support urlencoded titles as well
                if ( !$tc ) {
                }
  
                if ( is_null( $this->mTitle ) ) {
-                       wfProfileOut( __METHOD__.'-setup' );
+                       wfProfileOut( __METHOD__ . '-setup' );
                        wfProfileOut( __METHOD__ );
-                       throw new MWException( __METHOD__.": \$this->mTitle is null\n" );
+                       throw new MWException( __METHOD__ . ": \$this->mTitle is null\n" );
                }
                $nottalk = !$this->mTitle->isTalkPage();
  
                        $selflink = array( $this->mTitle->getPrefixedText() );
                }
                $useSubpages = $this->areSubpagesAllowed();
-               wfProfileOut( __METHOD__.'-setup' );
+               wfProfileOut( __METHOD__ . '-setup' );
  
                # Loop for each link
                for ( ; $line !== false && $line !== null ; $a->next(), $line = $a->current() ) {
                        }
  
                        if ( $useLinkPrefixExtension ) {
-                               wfProfileIn( __METHOD__.'-prefixhandling' );
+                               wfProfileIn( __METHOD__ . '-prefixhandling' );
                                if ( preg_match( $e2, $s, $m ) ) {
                                        $prefix = $m[2];
                                        $s = $m[1];
                                } else {
-                                       $prefix='';
+                                       $prefix = '';
                                }
                                # first link
                                if ( $first_prefix ) {
                                        $prefix = $first_prefix;
                                        $first_prefix = false;
                                }
-                               wfProfileOut( __METHOD__.'-prefixhandling' );
+                               wfProfileOut( __METHOD__ . '-prefixhandling' );
                        }
  
                        $might_be_img = false;
  
-                       wfProfileIn( __METHOD__."-e1" );
+                       wfProfileIn( __METHOD__ . "-e1" );
                        if ( preg_match( $e1, $line, $m ) ) { # page with normal text or alt
                                $text = $m[2];
                                # If we get a ] at the beginning of $m[3] that means we have a link that's something like:
                                $trail = "";
                        } else { # Invalid form; output directly
                                $s .= $prefix . '[[' . $line ;
-                               wfProfileOut( __METHOD__."-e1" );
+                               wfProfileOut( __METHOD__ . "-e1" );
                                continue;
                        }
-                       wfProfileOut( __METHOD__."-e1" );
-                       wfProfileIn( __METHOD__."-misc" );
+                       wfProfileOut( __METHOD__ . "-e1" );
+                       wfProfileIn( __METHOD__ . "-misc" );
  
                        # Don't allow internal links to pages containing
                        # PROTO: where PROTO is a valid URL protocol; these
                        # should be external links.
                        if ( preg_match( '/^(?i:' . $this->mUrlProtocols . ')/', $m[1] ) ) {
                                $s .= $prefix . '[[' . $line ;
-                               wfProfileOut( __METHOD__."-misc" );
+                               wfProfileOut( __METHOD__ . "-misc" );
                                continue;
                        }
  
                                $link = substr( $link, 1 );
                        }
  
-                       wfProfileOut( __METHOD__."-misc" );
-                       wfProfileIn( __METHOD__."-title" );
+                       wfProfileOut( __METHOD__ . "-misc" );
+                       wfProfileIn( __METHOD__ . "-title" );
                        $nt = Title::newFromText( $this->mStripState->unstripNoWiki( $link ) );
                        if ( $nt === null ) {
                                $s .= $prefix . '[[' . $line;
-                               wfProfileOut( __METHOD__."-title" );
+                               wfProfileOut( __METHOD__ . "-title" );
                                continue;
                        }
  
                        $ns = $nt->getNamespace();
                        $iw = $nt->getInterWiki();
-                       wfProfileOut( __METHOD__."-title" );
+                       wfProfileOut( __METHOD__ . "-title" );
  
                        if ( $might_be_img ) { # if this is actually an invalid link
-                               wfProfileIn( __METHOD__."-might_be_img" );
+                               wfProfileIn( __METHOD__ . "-might_be_img" );
                                if ( $ns == NS_FILE && $noforce ) { # but might be an image
                                        $found = false;
                                        while ( true ) {
                                                $holders->merge( $this->replaceInternalLinks2( $text ) );
                                                $s .= "{$prefix}[[$link|$text";
                                                # note: no $trail, because without an end, there *is* no trail
-                                               wfProfileOut( __METHOD__."-might_be_img" );
+                                               wfProfileOut( __METHOD__ . "-might_be_img" );
                                                continue;
                                        }
                                } else { # it's not an image, so output it raw
                                        $s .= "{$prefix}[[$link|$text";
                                        # note: no $trail, because without an end, there *is* no trail
-                                       wfProfileOut( __METHOD__."-might_be_img" );
+                                       wfProfileOut( __METHOD__ . "-might_be_img" );
                                        continue;
                                }
-                               wfProfileOut( __METHOD__."-might_be_img" );
+                               wfProfileOut( __METHOD__ . "-might_be_img" );
                        }
  
                        $wasblank = ( $text  == '' );
                        # Link not escaped by : , create the various objects
                        if ( $noforce ) {
                                # Interwikis
-                               wfProfileIn( __METHOD__."-interwiki" );
+                               wfProfileIn( __METHOD__ . "-interwiki" );
                                if ( $iw && $this->mOptions->getInterwikiMagic() && $nottalk && Language::fetchLanguageName( $iw, null, 'mw' ) ) {
                                        // XXX: the above check prevents links to sites with identifiers that are not language codes
  
  
                                        $s = rtrim( $s . $prefix );
                                        $s .= trim( $trail, "\n" ) == '' ? '': $prefix . $trail;
-                                       wfProfileOut( __METHOD__."-interwiki" );
+                                       wfProfileOut( __METHOD__ . "-interwiki" );
                                        continue;
                                }
-                               wfProfileOut( __METHOD__."-interwiki" );
+                               wfProfileOut( __METHOD__ . "-interwiki" );
  
                                if ( $ns == NS_FILE ) {
-                                       wfProfileIn( __METHOD__."-image" );
+                                       wfProfileIn( __METHOD__ . "-image" );
                                        if ( !wfIsBadImage( $nt->getDBkey(), $this->mTitle ) ) {
                                                if ( $wasblank ) {
                                                        # if no parameters were passed, $text
                                        } else {
                                                $s .= $prefix . $trail;
                                        }
-                                       wfProfileOut( __METHOD__."-image" );
+                                       wfProfileOut( __METHOD__ . "-image" );
                                        continue;
                                }
  
                                if ( $ns == NS_CATEGORY ) {
-                                       wfProfileIn( __METHOD__."-category" );
+                                       wfProfileIn( __METHOD__ . "-category" );
                                        $s = rtrim( $s . "\n" ); # bug 87
  
                                        if ( $wasblank ) {
                                         */
                                        $s .= trim( $prefix . $trail, "\n" ) == '' ? '' : $prefix . $trail;
  
-                                       wfProfileOut( __METHOD__."-category" );
+                                       wfProfileOut( __METHOD__ . "-category" );
                                        continue;
                                }
                        }
                        # NS_MEDIA is a pseudo-namespace for linking directly to a file
                        # @todo FIXME: Should do batch file existence checks, see comment below
                        if ( $ns == NS_MEDIA ) {
-                               wfProfileIn( __METHOD__."-media" );
+                               wfProfileIn( __METHOD__ . "-media" );
                                # Give extensions a chance to select the file revision for us
                                $options = array();
                                $descQuery = false;
                                # Cloak with NOPARSE to avoid replacement in replaceExternalLinks
                                $s .= $prefix . $this->armorLinks(
                                        Linker::makeMediaLinkFile( $nt, $file, $text ) ) . $trail;
-                               wfProfileOut( __METHOD__."-media" );
+                               wfProfileOut( __METHOD__ . "-media" );
                                continue;
                        }
  
-                       wfProfileIn( __METHOD__."-always_known" );
+                       wfProfileIn( __METHOD__ . "-always_known" );
                        # Some titles, such as valid special pages or files in foreign repos, should
                        # be shown as bluelinks even though they're not included in the page table
                        #
                                # Links will be added to the output link list after checking
                                $s .= $holders->makeHolder( $nt, $text, array(), $trail, $prefix );
                        }
-                       wfProfileOut( __METHOD__."-always_known" );
+                       wfProfileOut( __METHOD__ . "-always_known" );
                }
                wfProfileOut( __METHOD__ );
                return $holders;
                } else {
                        return '<!-- ERR 3 -->';
                }
-               return $text."\n";
+               return $text . "\n";
        }
        /**#@-*/
  
  
                        # If we have no prefixes, go to paragraph mode.
                        if ( 0 == $prefixLength ) {
-                               wfProfileIn( __METHOD__."-paragraph" );
+                               wfProfileIn( __METHOD__ . "-paragraph" );
                                # No prefix (not in list)--go to paragraph mode
                                # XXX: use a stack for nestable elements like span, table and div
                                $openmatch = preg_match('/(?:<table|<blockquote|<h1|<h2|<h3|<h4|<h5|<h6|<pre|<tr|<p|<ul|<ol|<dl|<li|<\\/tr|<\\/td|<\\/th)/iS', $t );
                                $closematch = preg_match(
                                        '/(?:<\\/table|<\\/blockquote|<\\/h1|<\\/h2|<\\/h3|<\\/h4|<\\/h5|<\\/h6|'.
-                                       '<td|<th|<\\/?div|<hr|<\\/pre|<\\/p|'.$this->mUniqPrefix.'-pre|<\\/li|<\\/ul|<\\/ol|<\\/dl|<\\/?center)/iS', $t );
+                                       '<td|<th|<\\/?div|<hr|<\\/pre|<\\/p|'.$this->mUniqPrefix . '-pre|<\\/li|<\\/ul|<\\/ol|<\\/dl|<\\/?center)/iS', $t );
                                if ( $openmatch or $closematch ) {
                                        $paragraphStack = false;
                                        # TODO bug 5718: paragraph closed
                                                # pre
                                                if ( $this->mLastSection !== 'pre' ) {
                                                        $paragraphStack = false;
-                                                       $output .= $this->closeParagraph().'<pre>';
+                                                       $output .= $this->closeParagraph() . '<pre>';
                                                        $this->mLastSection = 'pre';
                                                }
                                                $t = substr( $t, 1 );
                                                # paragraph
                                                if ( trim( $t ) === '' ) {
                                                        if ( $paragraphStack ) {
-                                                               $output .= $paragraphStack.'<br />';
+                                                               $output .= $paragraphStack . '<br />';
                                                                $paragraphStack = false;
                                                                $this->mLastSection = 'p';
                                                        } else {
                                                                $paragraphStack = false;
                                                                $this->mLastSection = 'p';
                                                        } elseif ( $this->mLastSection !== 'p' ) {
-                                                               $output .= $this->closeParagraph().'<p>';
+                                                               $output .= $this->closeParagraph() . '<p>';
                                                                $this->mLastSection = 'p';
                                                        }
                                                }
                                        }
                                }
-                               wfProfileOut( __METHOD__."-paragraph" );
+                               wfProfileOut( __METHOD__ . "-paragraph" );
                        }
                        # somewhere above we forget to get out of pre block (bug 785)
                        if ( $preCloseMatch && $this->mInPre ) {
                                $this->mInPre = false;
                        }
                        if ( $paragraphStack === false ) {
-                               $output .= $t."\n";
+                               $output .= $t . "\n";
                        }
                }
                while ( $prefixLength ) {
                                if ( $c === ">" ) {
                                        $stack--;
                                        if ( $stack < 0 ) {
-                                               wfDebug( __METHOD__.": Invalid input; too many close tags\n" );
+                                               wfDebug( __METHOD__ . ": Invalid input; too many close tags\n" );
                                                wfProfileOut( __METHOD__ );
                                                return false;
                                        }
                        }
                }
                if ( $stack > 0 ) {
-                       wfDebug( __METHOD__.": Invalid input; not enough close tags (stack $stack, state $state)\n" );
+                       wfDebug( __METHOD__ . ": Invalid input; not enough close tags (stack $stack, state $state)\n" );
                        wfProfileOut( __METHOD__ );
                        return false;
                }
                                $value = $this->getRevisionUser();
                                break;
                        case 'namespace':
-                               $value = str_replace( '_',' ',$wgContLang->getNsText( $this->mTitle->getNamespace() ) );
+                               $value = str_replace( '_', ' ', $wgContLang->getNsText( $this->mTitle->getNamespace() ) );
                                break;
                        case 'namespacee':
                                $value = wfUrlencode( $wgContLang->getNsText( $this->mTitle->getNamespace() ) );
                                $value = $this->mTitle->getNamespace();
                                break;
                        case 'talkspace':
-                               $value = $this->mTitle->canTalk() ? str_replace( '_',' ',$this->mTitle->getTalkNsText() ) : '';
+                               $value = $this->mTitle->canTalk() ? str_replace( '_', ' ', $this->mTitle->getTalkNsText() ) : '';
                                break;
                        case 'talkspacee':
                                $value = $this->mTitle->canTalk() ? wfUrlencode( $this->mTitle->getTalkNsText() ) : '';
                if ( $frame === false ) {
                        $frame = $this->getPreprocessor()->newFrame();
                } elseif ( !( $frame instanceof PPFrame ) ) {
-                       wfDebug( __METHOD__." called using plain parameters instead of a PPFrame instance. Creating custom frame.\n" );
+                       wfDebug( __METHOD__ . " called using plain parameters instead of a PPFrame instance. Creating custom frame.\n" );
                        $frame = $this->getPreprocessor()->newCustomFrame( $frame );
                }
  
        function braceSubstitution( $piece, $frame ) {
                global $wgContLang;
                wfProfileIn( __METHOD__ );
-               wfProfileIn( __METHOD__.'-setup' );
+               wfProfileIn( __METHOD__ . '-setup' );
  
                # Flags
                $found = false;             # $text has been filled
                # $args is a list of argument nodes, starting from index 0, not including $part1
                # @todo FIXME: If piece['parts'] is null then the call to getLength() below won't work b/c this $args isn't an object
                $args = ( null == $piece['parts'] ) ? array() : $piece['parts'];
-               wfProfileOut( __METHOD__.'-setup' );
+               wfProfileOut( __METHOD__ . '-setup' );
  
                $titleProfileIn = null; // profile templates
  
                # SUBST
-               wfProfileIn( __METHOD__.'-modifiers' );
+               wfProfileIn( __METHOD__ . '-modifiers' );
                if ( !$found ) {
  
                        $substMatch = $this->mSubstWords->matchStartAndRemove( $part1 );
                                $forceRawInterwiki = true;
                        }
                }
-               wfProfileOut( __METHOD__.'-modifiers' );
+               wfProfileOut( __METHOD__ . '-modifiers' );
  
                # Parser functions
                if ( !$found ) {
                                        }
                                } elseif ( MWNamespace::isNonincludable( $title->getNamespace() ) ) {
                                        $found = false; # access denied
-                                       wfDebug( __METHOD__.": template inclusion denied for " . $title->getPrefixedDBkey() );
+                                       wfDebug( __METHOD__ . ": template inclusion denied for " . $title->getPrefixedDBkey() );
                                } else {
                                        list( $text, $title ) = $this->getTemplateDom( $title );
                                        if ( $text !== false ) {
                                $text = '<span class="error">'
                                        . wfMessage( 'parser-template-loop-warning', $titleText )->inContentLanguage()->text()
                                        . '</span>';
-                               wfDebug( __METHOD__.": template loop broken at '$titleText'\n" );
+                               wfDebug( __METHOD__ . ": template loop broken at '$titleText'\n" );
                        }
                        wfProfileOut( __METHOD__ . '-loadtpl' );
                }
                } elseif ( $markerType === 'general' ) {
                        $this->mStripState->addGeneral( $marker, $output );
                } else {
-                       throw new MWException( __METHOD__.': invalid marker type' );
+                       throw new MWException( __METHOD__ . ': invalid marker type' );
                }
                return $marker;
        }
         */
        public function addTrackingCategory( $msg ) {
                if ( $this->mTitle->getNamespace() === NS_SPECIAL ) {
-                       wfDebug( __METHOD__.": Not adding tracking category $msg to special page!\n" );
+                       wfDebug( __METHOD__ . ": Not adding tracking category $msg to special page!\n" );
                        return false;
                }
                // Important to parse with correct title (bug 31469)
                        $this->mOutput->addCategory( $containerCategory->getDBkey(), $this->getDefaultSort() );
                        return true;
                } else {
-                       wfDebug( __METHOD__.": [[MediaWiki:$msg]] is not a valid title!\n" );
+                       wfDebug( __METHOD__ . ": [[MediaWiki:$msg]] is not a valid title!\n" );
                        return false;
                }
        }
                                // of data, but put the headline hint inside a content block because the language converter is supposed to
                                // be able to convert that piece of data.
                                $editlink = '<mw:editsection page="' . htmlspecialchars($editlinkArgs[0]);
-                               $editlink .= '" section="' . htmlspecialchars($editlinkArgs[1]) .'"';
+                               $editlink .= '" section="' . htmlspecialchars($editlinkArgs[1]) . '"';
                                if ( isset($editlinkArgs[2]) ) {
                                        $editlink .= '>' . $editlinkArgs[2] . '</mw:editsection>';
                                } else {
                        } else {
                                # Failed to validate; fall back to the default
                                $nickname = $username;
-                               wfDebug( __METHOD__.": $username has bad XML tags in signature.\n" );
+                               wfDebug( __METHOD__ . ": $username has bad XML tags in signature.\n" );
                        }
                }
  
                # Add to function cache
                $mw = MagicWord::get( $id );
                if ( !$mw )
-                       throw new MWException( __METHOD__.'() expecting a magic word identifier.' );
+                       throw new MWException( __METHOD__ . '() expecting a magic word identifier.' );
  
                $synonyms = $mw->getSynonyms();
                $sensitive = intval( $mw->isCaseSensitive() );
                                        if ( $match = $magicWordAlt->matchVariableStartToEnd( $parameterMatch ) ) {
                                                $alt = $this->stripAltText( $match, false );
                                        }
-                                       elseif( $match = $magicWordLink->matchVariableStartToEnd( $parameterMatch ) ){
+                                       elseif( $match = $magicWordLink->matchVariableStartToEnd( $parameterMatch ) ) {
                                                $linkValue = strip_tags( $this->replaceLinkHoldersText( $match ) );
                                                $chars = self::EXT_LINK_URL_CLASS;
                                                $prots = $this->mUrlProtocols;
                                $label = substr( $label, 1 );
                        }
  
-                       $ig->add( $title, $label, $alt ,$link);
+                       $ig->add( $title, $label, $alt, $link );
                }
                return $ig->toHTML();
        }
         */
        function unserializeHalfParsedText( $data ) {
                if ( !isset( $data['version'] ) || $data['version'] != self::HALF_PARSED_VERSION ) {
-                       throw new MWException( __METHOD__.': invalid version' );
+                       throw new MWException( __METHOD__ . ': invalid version' );
                }
  
                # First, extract the strip state.