http://www.mediawiki.org/wiki/Special:Code/MediaWiki/62873

Revision: 62873
Author:   ashley
Date:     2010-02-23 12:30:23 +0000 (Tue, 23 Feb 2010)

Log Message:
-----------
API: coding style cleanup, fix copyright symbol, more braces

Modified Paths:
--------------
    trunk/phase3/includes/api/ApiFeedWatchlist.php
    trunk/phase3/includes/api/ApiFormatBase.php
    trunk/phase3/includes/api/ApiFormatDbg.php
    trunk/phase3/includes/api/ApiFormatJson.php
    trunk/phase3/includes/api/ApiFormatPhp.php
    trunk/phase3/includes/api/ApiFormatRaw.php
    trunk/phase3/includes/api/ApiFormatTxt.php
    trunk/phase3/includes/api/ApiFormatWddx.php

Modified: trunk/phase3/includes/api/ApiFeedWatchlist.php
===================================================================
--- trunk/phase3/includes/api/ApiFeedWatchlist.php      2010-02-23 12:24:19 UTC 
(rev 62872)
+++ trunk/phase3/includes/api/ApiFeedWatchlist.php      2010-02-23 12:30:23 UTC 
(rev 62873)
@@ -1,11 +1,11 @@
 <?php
 
-/*
+/**
  * Created on Oct 13, 2006
  *
  * API for MediaWiki 1.8+
  *
- * Copyright (C) 2006 Yuri Astrakhan <Firstname><Lastname>@gmail.com
+ * Copyright © 2006 Yuri Astrakhan <Firstname><Lastname>@gmail.com
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -25,7 +25,7 @@
 
 if ( !defined( 'MEDIAWIKI' ) ) {
        // Eclipse helper - will be ignored in production
-       require_once ( "ApiBase.php" );
+       require_once( "ApiBase.php" );
 }
 
 /**
@@ -38,7 +38,7 @@
 class ApiFeedWatchlist extends ApiBase {
 
        public function __construct( $main, $action ) {
-               parent :: __construct( $main, $action );
+               parent::__construct( $main, $action );
        }
 
        /**
@@ -53,7 +53,6 @@
         * Wrap the result as an RSS/Atom feed.
         */
        public function execute() {
-
                global $wgFeedClasses, $wgFeedLimit, $wgSitename, 
$wgContLanguageCode;
 
                try {
@@ -64,13 +63,13 @@
 
                        $dbr = wfGetDB( DB_SLAVE );
                        // Prepare parameters for nested request
-                       $fauxReqArr = array (
+                       $fauxReqArr = array(
                                'action' => 'query',
                                'meta' => 'siteinfo',
                                'siprop' => 'general',
                                'list' => 'watchlist',
                                'wlprop' => 'title|user|comment|timestamp',
-                               'wldir' => 'older',             // reverse 
order - from newest to oldest
+                               'wldir' => 'older', // reverse order - from 
newest to oldest
                                'wlend' => $dbr->timestamp( $endTime ), // stop 
at this time
                                'wllimit' => ( 50 > $wgFeedLimit ) ? 
$wgFeedLimit : 50
                        );
@@ -83,12 +82,12 @@
                        }
 
                        // Check for 'allrev' parameter, and if found, show all 
revisions to each page on wl.
-                       if ( !is_null ( $params['allrev'] ) ) {
+                       if ( !is_null( $params['allrev'] ) ) {
                                $fauxReqArr['wlallrev'] = '';
                        }
 
                        // Create the request
-                       $fauxReq = new FauxRequest ( $fauxReqArr );
+                       $fauxReq = new FauxRequest( $fauxReqArr );
 
                        // Execute
                        $module = new ApiMain( $fauxReq );
@@ -103,11 +102,11 @@
                        }
 
                        $feedTitle = $wgSitename . ' - ' . wfMsgForContent( 
'watchlist' ) . ' [' . $wgContLanguageCode . ']';
-                       $feedUrl = SpecialPage::getTitleFor( 'Watchlist' 
)->getFullUrl();
+                       $feedUrl = SpecialPage::getTitleFor( 'Watchlist' 
)->getFullURL();
 
                        $feed = new $wgFeedClasses[$params['feedformat']] ( 
$feedTitle, htmlspecialchars( wfMsgForContent( 'watchlist' ) ), $feedUrl );
 
-                       ApiFormatFeedWrapper :: setResult( $this->getResult(), 
$feed, $feedItems );
+                       ApiFormatFeedWrapper::setResult( $this->getResult(), 
$feed, $feedItems );
 
                } catch ( Exception $e ) {
 
@@ -115,7 +114,7 @@
                        $this->getMain()->setCacheMaxAge( 0 );
 
                        $feedTitle = $wgSitename . ' - Error - ' . 
wfMsgForContent( 'watchlist' ) . ' [' . $wgContLanguageCode . ']';
-                       $feedUrl = SpecialPage::getTitleFor( 'Watchlist' 
)->getFullUrl();
+                       $feedUrl = SpecialPage::getTitleFor( 'Watchlist' 
)->getFullURL();
 
                        $feedFormat = isset( $params['feedformat'] ) ? 
$params['feedformat'] : 'rss';
                        $feed = new $wgFeedClasses[$feedFormat] ( $feedTitle, 
htmlspecialchars( wfMsgForContent( 'watchlist' ) ), $feedUrl );
@@ -128,15 +127,15 @@
                        }
 
                        $errorText = $e->getMessage();
-                       $feedItems[] = new FeedItem( "Error ($errorCode)", 
$errorText, "", "", "" );
-                       ApiFormatFeedWrapper :: setResult( $this->getResult(), 
$feed, $feedItems );
+                       $feedItems[] = new FeedItem( "Error ($errorCode)", 
$errorText, '', '', '' );
+                       ApiFormatFeedWrapper::setResult( $this->getResult(), 
$feed, $feedItems );
                }
        }
 
        private function createFeedItem( $info ) {
                $titleStr = $info['title'];
-               $title = Title :: newFromText( $titleStr );
-               $titleUrl = $title->getFullUrl();
+               $title = Title::newFromText( $titleStr );
+               $titleUrl = $title->getFullURL();
                $comment = isset( $info['comment'] ) ? $info['comment'] : null;
                $timestamp = $info['timestamp'];
                $user = $info['user'];
@@ -150,28 +149,28 @@
                global $wgFeedClasses;
                $feedFormatNames = array_keys( $wgFeedClasses );
                return array (
-                       'feedformat' => array (
-                               ApiBase :: PARAM_DFLT => 'rss',
-                               ApiBase :: PARAM_TYPE => $feedFormatNames
+                       'feedformat' => array(
+                               ApiBase::PARAM_DFLT => 'rss',
+                               ApiBase::PARAM_TYPE => $feedFormatNames
                        ),
-                       'hours' => array (
-                               ApiBase :: PARAM_DFLT => 24,
-                               ApiBase :: PARAM_TYPE => 'integer',
-                               ApiBase :: PARAM_MIN => 1,
-                               ApiBase :: PARAM_MAX => 72,
+                       'hours' => array(
+                               ApiBase::PARAM_DFLT => 24,
+                               ApiBase::PARAM_TYPE => 'integer',
+                               ApiBase::PARAM_MIN => 1,
+                               ApiBase::PARAM_MAX => 72,
                        ),
                        'allrev' => null,
-                       'wlowner' => array (
-                               ApiBase :: PARAM_TYPE => 'user'
+                       'wlowner' => array(
+                               ApiBase::PARAM_TYPE => 'user'
                        ),
-                       'wltoken' => array (
-                               ApiBase :: PARAM_TYPE => 'string'
+                       'wltoken' => array(
+                               ApiBase::PARAM_TYPE => 'string'
                        )
                );
        }
 
        public function getParamDescription() {
-               return array (
+               return array(
                        'feedformat' => 'The format of the feed',
                        'hours'      => 'List pages modified within this many 
hours from now',
                        'allrev'     => 'Include multiple revisions of the same 
page within given timeframe.',
@@ -185,7 +184,7 @@
        }
 
        protected function getExamples() {
-               return array (
+               return array(
                        'api.php?action=feedwatchlist'
                );
        }

Modified: trunk/phase3/includes/api/ApiFormatBase.php
===================================================================
--- trunk/phase3/includes/api/ApiFormatBase.php 2010-02-23 12:24:19 UTC (rev 
62872)
+++ trunk/phase3/includes/api/ApiFormatBase.php 2010-02-23 12:30:23 UTC (rev 
62873)
@@ -1,11 +1,11 @@
 <?php
 
-/*
+/**
  * Created on Sep 19, 2006
  *
  * API for MediaWiki 1.8+
  *
- * Copyright (C) 2006 Yuri Astrakhan <Firstname><Lastname>@gmail.com
+ * Copyright © 2006 Yuri Astrakhan <Firstname><Lastname>@gmail.com
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -25,7 +25,7 @@
 
 if ( !defined( 'MEDIAWIKI' ) ) {
        // Eclipse helper - will be ignored in production
-       require_once ( 'ApiBase.php' );
+       require_once( 'ApiBase.php' );
 }
 
 /**
@@ -45,13 +45,14 @@
         * @param $format string Format name
         */
        public function __construct( $main, $format ) {
-               parent :: __construct( $main, $format );
+               parent::__construct( $main, $format );
 
                $this->mIsHtml = ( substr( $format, - 2, 2 ) === 'fm' ); // 
ends with 'fm'
-               if ( $this->mIsHtml )
+               if ( $this->mIsHtml ) {
                        $this->mFormat = substr( $format, 0, - 2 ); // remove 
ending 'fm'
-               else
+               } else {
                        $this->mFormat = $format;
+               }
                $this->mFormat = strtoupper( $this->mFormat );
                $this->mCleared = false;
        }
@@ -125,8 +126,9 @@
 
                // Some printers (ex. Feed) do their own header settings,
                // in which case $mime will be set to null
-               if ( is_null( $mime ) )
+               if ( is_null( $mime ) ) {
                        return; // skip any initialization
+               }
 
                header( "Content-Type: $mime; charset=utf-8" );
 
@@ -197,8 +199,7 @@
                        // For non-HTML output, clear all errors that might 
have been
                        // displayed if display_errors=On
                        // Do this only once, of course
-                       if ( !$this->mCleared )
-                       {
+                       if ( !$this->mCleared ) {
                                ob_clean();
                                $this->mCleared = true;
                        }
@@ -228,11 +229,11 @@
        }
 
        /**
-       * Prety-print various elements in HTML format, such as xml tags and
-       * URLs. This method also escapes characters like <
-       * @param $text string
-       * @return string
-       */
+        * Pretty-print various elements in HTML format, such as xml tags and
+        * URLs. This method also escapes characters like <
+        * @param $text string
+        * @return string
+        */
        protected function formatHTML( $text ) {
                global $wgUrlProtocols;
 
@@ -254,12 +255,15 @@
                        $text = preg_replace( "#\\$[^<>\n]+\\$#", 
'<b><i>\\0</i></b>', $text );
                }
 
-               /* Temporary fix for bad links in help messages. As a special 
case,
+               /**
+                * Temporary fix for bad links in help messages. As a special 
case,
                 * XML-escaped metachars are de-escaped one level in the help 
message
-                * for legibility. Should be removed once we have completed a 
fully-html
-                * version of the help message. */
-               if ( $this->mUnescapeAmps )
+                * for legibility. Should be removed once we have completed a 
fully-HTML
+                * version of the help message.
+                */
+               if ( $this->mUnescapeAmps ) {
                        $text = preg_replace( '/&amp;(amp|quot|lt|gt);/', 
'&\1;', $text );
+               }
 
                return $text;
        }
@@ -284,7 +288,7 @@
 class ApiFormatFeedWrapper extends ApiFormatBase {
 
        public function __construct( $main ) {
-               parent :: __construct( $main, 'feed' );
+               parent::__construct( $main, 'feed' );
        }
 
        /**
@@ -326,13 +330,14 @@
         */
        public function execute() {
                $data = $this->getResultData();
-               if ( isset ( $data['_feed'] ) && isset ( $data['_feeditems'] ) 
) {
+               if ( isset( $data['_feed'] ) && isset( $data['_feeditems'] ) ) {
                        $feed = $data['_feed'];
                        $items = $data['_feeditems'];
 
                        $feed->outHeader();
-                       foreach ( $items as & $item )
+                       foreach ( $items as & $item ) {
                                $feed->outItem( $item );
+                       }
                        $feed->outFooter();
                } else {
                        // Error has occured, print something useful

Modified: trunk/phase3/includes/api/ApiFormatDbg.php
===================================================================
--- trunk/phase3/includes/api/ApiFormatDbg.php  2010-02-23 12:24:19 UTC (rev 
62872)
+++ trunk/phase3/includes/api/ApiFormatDbg.php  2010-02-23 12:30:23 UTC (rev 
62873)
@@ -1,11 +1,11 @@
 <?php
 
-/*
+/**
  * Created on Oct 22, 2006
  *
  * API for MediaWiki 1.8+
  *
- * Copyright (C) 2008 Roan Kattouw <Firstname>.<Lastname>@home.nl
+ * Copyright © 2008 Roan Kattouw <Firstname>.<Lastname>@home.nl
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -25,7 +25,7 @@
 
 if ( !defined( 'MEDIAWIKI' ) ) {
        // Eclipse helper - will be ignored in production
-       require_once ( 'ApiFormatBase.php' );
+       require_once( 'ApiFormatBase.php' );
 }
 
 /**
@@ -34,7 +34,7 @@
 class ApiFormatDbg extends ApiFormatBase {
 
        public function __construct( $main, $format ) {
-               parent :: __construct( $main, $format );
+               parent::__construct( $main, $format );
        }
 
        public function getMimeType() {
@@ -49,7 +49,7 @@
        }
 
        public function getDescription() {
-               return 'Output data in PHP\'s var_export() format' . parent :: 
getDescription();
+               return 'Output data in PHP\'s var_export() format' . 
parent::getDescription();
        }
 
        public function getVersion() {

Modified: trunk/phase3/includes/api/ApiFormatJson.php
===================================================================
--- trunk/phase3/includes/api/ApiFormatJson.php 2010-02-23 12:24:19 UTC (rev 
62872)
+++ trunk/phase3/includes/api/ApiFormatJson.php 2010-02-23 12:30:23 UTC (rev 
62873)
@@ -1,11 +1,11 @@
 <?php
 
-/*
+/**
  * Created on Sep 19, 2006
  *
  * API for MediaWiki 1.8+
  *
- * Copyright (C) 2006 Yuri Astrakhan <Firstname><Lastname>@gmail.com
+ * Copyright © 2006 Yuri Astrakhan <Firstname><Lastname>@gmail.com
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -25,7 +25,7 @@
 
 if ( !defined( 'MEDIAWIKI' ) ) {
        // Eclipse helper - will be ignored in production
-       require_once ( 'ApiFormatBase.php' );
+       require_once( 'ApiFormatBase.php' );
 }
 
 /**
@@ -36,7 +36,7 @@
        private $mIsRaw;
 
        public function __construct( $main, $format ) {
-               parent :: __construct( $main, $format );
+               parent::__construct( $main, $format );
                $this->mIsRaw = ( $format === 'rawfm' );
        }
 
@@ -59,37 +59,39 @@
        }
 
        public function execute() {
-               $prefix = $suffix = "";
+               $prefix = $suffix = '';
 
                $params = $this->extractRequestParams();
                $callback = $params['callback'];
                if ( !is_null( $callback ) ) {
-                       $prefix = preg_replace( "/[^][.\\'\\\"_A-Za-z0-9]/", 
"", $callback ) . "(";
-                       $suffix = ")";
+                       $prefix = preg_replace( "/[^][.\\'\\\"_A-Za-z0-9]/", 
'', $callback ) . '(';
+                       $suffix = ')';
                }
                $this->printText(
                        $prefix .
                        FormatJson::encode( $this->getResultData(),     
$this->getIsHtml() ) .
-                       $suffix );
+                       $suffix
+               );
        }
 
        public function getAllowedParams() {
-               return array (
+               return array(
                        'callback'  => null,
                );
        }
 
        public function getParamDescription() {
-               return array (
+               return array(
                        'callback' => 'If specified, wraps the output into a 
given function call. For safety, all user-specific data will be restricted.',
                );
        }
 
        public function getDescription() {
-               if ( $this->mIsRaw )
-                       return 'Output data with the debuging elements in JSON 
format' . parent :: getDescription();
-               else
-                       return 'Output data in JSON format' . parent :: 
getDescription();
+               if ( $this->mIsRaw ) {
+                       return 'Output data with the debuging elements in JSON 
format' . parent::getDescription();
+               } else {
+                       return 'Output data in JSON format' . 
parent::getDescription();
+               }
        }
 
        public function getVersion() {

Modified: trunk/phase3/includes/api/ApiFormatPhp.php
===================================================================
--- trunk/phase3/includes/api/ApiFormatPhp.php  2010-02-23 12:24:19 UTC (rev 
62872)
+++ trunk/phase3/includes/api/ApiFormatPhp.php  2010-02-23 12:30:23 UTC (rev 
62873)
@@ -1,11 +1,11 @@
 <?php
 
-/*
+/**
  * Created on Oct 22, 2006
  *
  * API for MediaWiki 1.8+
  *
- * Copyright (C) 2006 Yuri Astrakhan <Firstname><Lastname>@gmail.com
+ * Copyright © 2006 Yuri Astrakhan <Firstname><Lastname>@gmail.com
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -25,7 +25,7 @@
 
 if ( !defined( 'MEDIAWIKI' ) ) {
        // Eclipse helper - will be ignored in production
-       require_once ( 'ApiFormatBase.php' );
+       require_once( 'ApiFormatBase.php' );
 }
 
 /**
@@ -34,7 +34,7 @@
 class ApiFormatPhp extends ApiFormatBase {
 
        public function __construct( $main, $format ) {
-               parent :: __construct( $main, $format );
+               parent::__construct( $main, $format );
        }
 
        public function getMimeType() {
@@ -46,7 +46,7 @@
        }
 
        public function getDescription() {
-               return 'Output data in serialized PHP format' . parent :: 
getDescription();
+               return 'Output data in serialized PHP format' . 
parent::getDescription();
        }
 
        public function getVersion() {

Modified: trunk/phase3/includes/api/ApiFormatRaw.php
===================================================================
--- trunk/phase3/includes/api/ApiFormatRaw.php  2010-02-23 12:24:19 UTC (rev 
62872)
+++ trunk/phase3/includes/api/ApiFormatRaw.php  2010-02-23 12:30:23 UTC (rev 
62873)
@@ -1,11 +1,11 @@
 <?php
 
-/*
+/**
  * Created on Feb 2, 2009
  *
  * API for MediaWiki 1.8+
  *
- * Copyright (C) 2009 Roan Kattouw <Firstname>.<Lastname>@home.nl
+ * Copyright © 2009 Roan Kattouw <Firstname>.<Lastname>@home.nl
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -25,7 +25,7 @@
 
 if ( !defined( 'MEDIAWIKI' ) ) {
        // Eclipse helper - will be ignored in production
-       require_once ( 'ApiFormatBase.php' );
+       require_once( 'ApiFormatBase.php' );
 }
 
 /**
@@ -40,32 +40,34 @@
         * @param $errorFallback Formatter object to fall back on for errors
         */
        public function __construct( $main, $errorFallback ) {
-               parent :: __construct( $main, 'raw' );
+               parent::__construct( $main, 'raw' );
                $this->mErrorFallback = $errorFallback;
        }
 
        public function getMimeType() {
                $data = $this->getResultData();
 
-               if ( isset( $data['error'] ) )
+               if ( isset( $data['error'] ) ) {
                        return $this->mErrorFallback->getMimeType();
+               }
 
-               if ( !isset( $data['mime'] ) )
-                       ApiBase::dieDebug( __METHOD__, "No MIME type set for 
raw formatter" );
-       
+               if ( !isset( $data['mime'] ) ) {
+                       ApiBase::dieDebug( __METHOD__, 'No MIME type set for 
raw formatter' );
+               }
+
                return $data['mime'];
        }
 
        public function execute() {
                $data = $this->getResultData();
-               if ( isset( $data['error'] ) )
-               {
+               if ( isset( $data['error'] ) ) {
                        $this->mErrorFallback->execute();
                        return;
                }
-               
-               if ( !isset( $data['text'] ) )
-                       ApiBase::dieDebug( __METHOD__, "No text given for raw 
formatter" );
+
+               if ( !isset( $data['text'] ) ) {
+                       ApiBase::dieDebug( __METHOD__, 'No text given for raw 
formatter' );
+               }
                $this->printText( $data['text'] );
        }
 

Modified: trunk/phase3/includes/api/ApiFormatTxt.php
===================================================================
--- trunk/phase3/includes/api/ApiFormatTxt.php  2010-02-23 12:24:19 UTC (rev 
62872)
+++ trunk/phase3/includes/api/ApiFormatTxt.php  2010-02-23 12:30:23 UTC (rev 
62873)
@@ -1,11 +1,11 @@
 <?php
 
-/*
+/**
  * Created on Oct 22, 2006
  *
  * API for MediaWiki 1.8+
  *
- * Copyright (C) 2008 Roan Kattouw <Firstname>.<Lastname>@home.nl
+ * Copyright © 2008 Roan Kattouw <Firstname>.<Lastname>@home.nl
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -25,7 +25,7 @@
 
 if ( !defined( 'MEDIAWIKI' ) ) {
        // Eclipse helper - will be ignored in production
-       require_once ( 'ApiFormatBase.php' );
+       require_once( 'ApiFormatBase.php' );
 }
 
 /**
@@ -34,7 +34,7 @@
 class ApiFormatTxt extends ApiFormatBase {
 
        public function __construct( $main, $format ) {
-               parent :: __construct( $main, $format );
+               parent::__construct( $main, $format );
        }
 
        public function getMimeType() {
@@ -49,7 +49,7 @@
        }
 
        public function getDescription() {
-               return 'Output data in PHP\'s print_r() format' . parent :: 
getDescription();
+               return 'Output data in PHP\'s print_r() format' . 
parent::getDescription();
        }
 
        public function getVersion() {

Modified: trunk/phase3/includes/api/ApiFormatWddx.php
===================================================================
--- trunk/phase3/includes/api/ApiFormatWddx.php 2010-02-23 12:24:19 UTC (rev 
62872)
+++ trunk/phase3/includes/api/ApiFormatWddx.php 2010-02-23 12:30:23 UTC (rev 
62873)
@@ -1,11 +1,11 @@
 <?php
 
-/*
+/**
  * Created on Oct 22, 2006
  *
  * API for MediaWiki 1.8+
  *
- * Copyright (C) 2006 Yuri Astrakhan <Firstname><Lastname>@gmail.com
+ * Copyright © 2006 Yuri Astrakhan <Firstname><Lastname>@gmail.com
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -25,7 +25,7 @@
 
 if ( !defined( 'MEDIAWIKI' ) ) {
        // Eclipse helper - will be ignored in production
-       require_once ( 'ApiFormatBase.php' );
+       require_once( 'ApiFormatBase.php' );
 }
 
 /**
@@ -34,7 +34,7 @@
 class ApiFormatWddx extends ApiFormatBase {
 
        public function __construct( $main, $format ) {
-               parent :: __construct( $main, $format );
+               parent::__construct( $main, $format );
        }
 
        public function getMimeType() {
@@ -53,8 +53,8 @@
                } else {
                        // Don't do newlines and indentation if we weren't asked
                        // for pretty output
-                       $nl = ( $this->getIsHtml() ? "" : "\n" );
-                       $indstr = " ";
+                       $nl = ( $this->getIsHtml() ? '' : "\n" );
+                       $indstr = ' ';
                        $this->printText( "<?xml version=\"1.0\"?>$nl" );
                        $this->printText( "<wddxPacket version=\"1.0\">$nl" );
                        $this->printText( "$indstr<header/>$nl" );
@@ -69,11 +69,11 @@
         * Recursively go through the object and output its data in WDDX format.
         */
        function slowWddxPrinter( $elemValue, $indent = 0 ) {
-               $indstr = ( $this->getIsHtml() ? "" : str_repeat( ' ', $indent 
) );
-               $indstr2 = ( $this->getIsHtml() ? "" : str_repeat( ' ', $indent 
+ 2 ) );
-               $nl = ( $this->getIsHtml() ? "" : "\n" );
+               $indstr = ( $this->getIsHtml() ? '' : str_repeat( ' ', $indent 
) );
+               $indstr2 = ( $this->getIsHtml() ? '' : str_repeat( ' ', $indent 
+ 2 ) );
+               $nl = ( $this->getIsHtml() ? '' : "\n" );
                switch ( gettype( $elemValue ) ) {
-                       case 'array' :
+                       case 'array':
                                // Check whether we've got an associative array 
(<struct>)
                                // or a regular array (<array>)
                                $cnt = count( $elemValue );
@@ -81,8 +81,9 @@
                                        // Regular array
                                        $this->printText( $indstr . 
Xml::element( 'array', array(
                                                'length' => $cnt ), null ) . 
$nl );
-                                       foreach ( $elemValue as $subElemValue )
+                                       foreach ( $elemValue as $subElemValue ) 
{
                                                $this->slowWddxPrinter( 
$subElemValue, $indent + 2 );
+                                       }
                                        $this->printText( "$indstr</array>$nl" 
);
                                } else {
                                        // Associative array (<struct>)
@@ -97,20 +98,20 @@
                                        $this->printText( "$indstr</struct>$nl" 
);
                                }
                                break;
-                       case 'integer' :
-                       case 'double' :
+                       case 'integer':
+                       case 'double':
                                $this->printText( $indstr . Xml::element( 
'number', null, $elemValue ) . $nl );
                                break;
-                       case 'string' :
+                       case 'string':
                                $this->printText( $indstr . Xml::element( 
'string', null, $elemValue ) . $nl );
                                break;
-                       default :
-                               ApiBase :: dieDebug( __METHOD__, 'Unknown type 
' . gettype( $elemValue ) );
+                       default:
+                               ApiBase::dieDebug( __METHOD__, 'Unknown type ' 
. gettype( $elemValue ) );
                }
        }
 
        public function getDescription() {
-               return 'Output data in WDDX format' . parent :: 
getDescription();
+               return 'Output data in WDDX format' . parent::getDescription();
        }
 
        public function getVersion() {



_______________________________________________
MediaWiki-CVS mailing list
MediaWiki-CVS@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to