API: coding style cleanup, fix copyright symbol, more braces
authorJack Phoenix <ashley@users.mediawiki.org>
Tue, 23 Feb 2010 12:30:23 +0000 (12:30 +0000)
committerJack Phoenix <ashley@users.mediawiki.org>
Tue, 23 Feb 2010 12:30:23 +0000 (12:30 +0000)
includes/api/ApiFeedWatchlist.php
includes/api/ApiFormatBase.php
includes/api/ApiFormatDbg.php
includes/api/ApiFormatJson.php
includes/api/ApiFormatPhp.php
includes/api/ApiFormatRaw.php
includes/api/ApiFormatTxt.php
includes/api/ApiFormatWddx.php

index 2fd2d74..f18cbe3 100644 (file)
@@ -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 @@ if ( !defined( 'MEDIAWIKI' ) ) {
 class ApiFeedWatchlist extends ApiBase {
 
        public function __construct( $main, $action ) {
-               parent :: __construct( $main, $action );
+               parent::__construct( $main, $action );
        }
 
        /**
@@ -53,7 +53,6 @@ class ApiFeedWatchlist extends ApiBase {
         * Wrap the result as an RSS/Atom feed.
         */
        public function execute() {
-
                global $wgFeedClasses, $wgFeedLimit, $wgSitename, $wgContLanguageCode;
 
                try {
@@ -64,13 +63,13 @@ class ApiFeedWatchlist extends ApiBase {
 
                        $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 @@ class ApiFeedWatchlist extends ApiBase {
                        }
 
                        // 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 @@ class ApiFeedWatchlist extends ApiBase {
                        }
 
                        $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 @@ class ApiFeedWatchlist extends ApiBase {
                        $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 @@ class ApiFeedWatchlist extends ApiBase {
                        }
 
                        $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 @@ class ApiFeedWatchlist extends ApiBase {
                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 @@ class ApiFeedWatchlist extends ApiBase {
        }
 
        protected function getExamples() {
-               return array (
+               return array(
                        'api.php?action=feedwatchlist'
                );
        }
index d5f1ea4..3ad1419 100644 (file)
@@ -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 @@ abstract class ApiFormatBase extends ApiBase {
         * @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 @@ abstract class ApiFormatBase extends ApiBase {
 
                // 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 @@ See <a href='http://www.mediawiki.org/wiki/API'>complete documentation</a>, or
                        // 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 @@ See <a href='http://www.mediawiki.org/wiki/API'>complete documentation</a>, or
        }
 
        /**
-       * 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 @@ See <a href='http://www.mediawiki.org/wiki/API'>complete documentation</a>, or
                        $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 @@ See <a href='http://www.mediawiki.org/wiki/API'>complete documentation</a>, or
 class ApiFormatFeedWrapper extends ApiFormatBase {
 
        public function __construct( $main ) {
-               parent :: __construct( $main, 'feed' );
+               parent::__construct( $main, 'feed' );
        }
 
        /**
@@ -326,13 +330,14 @@ class ApiFormatFeedWrapper extends ApiFormatBase {
         */
        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
index 597184a..89dad1e 100644 (file)
@@ -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 @@ if ( !defined( 'MEDIAWIKI' ) ) {
 class ApiFormatDbg extends ApiFormatBase {
 
        public function __construct( $main, $format ) {
-               parent :: __construct( $main, $format );
+               parent::__construct( $main, $format );
        }
 
        public function getMimeType() {
@@ -49,7 +49,7 @@ class ApiFormatDbg extends ApiFormatBase {
        }
 
        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() {
index ab62b9e..c1ea892 100644 (file)
@@ -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 @@ class ApiFormatJson extends ApiFormatBase {
        private $mIsRaw;
 
        public function __construct( $main, $format ) {
-               parent :: __construct( $main, $format );
+               parent::__construct( $main, $format );
                $this->mIsRaw = ( $format === 'rawfm' );
        }
 
@@ -59,37 +59,39 @@ class ApiFormatJson extends ApiFormatBase {
        }
 
        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() {
index a2d5d1e..07e371c 100644 (file)
@@ -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 @@ if ( !defined( 'MEDIAWIKI' ) ) {
 class ApiFormatPhp extends ApiFormatBase {
 
        public function __construct( $main, $format ) {
-               parent :: __construct( $main, $format );
+               parent::__construct( $main, $format );
        }
 
        public function getMimeType() {
@@ -46,7 +46,7 @@ class ApiFormatPhp extends ApiFormatBase {
        }
 
        public function getDescription() {
-               return 'Output data in serialized PHP format' . parent :: getDescription();
+               return 'Output data in serialized PHP format' . parent::getDescription();
        }
 
        public function getVersion() {
index ee8f573..9eff79a 100644 (file)
@@ -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 @@ class ApiFormatRaw extends ApiFormatBase {
         * @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'] );
        }
 
index dcb3d28..bbe0e9a 100644 (file)
@@ -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 @@ if ( !defined( 'MEDIAWIKI' ) ) {
 class ApiFormatTxt extends ApiFormatBase {
 
        public function __construct( $main, $format ) {
-               parent :: __construct( $main, $format );
+               parent::__construct( $main, $format );
        }
 
        public function getMimeType() {
@@ -49,7 +49,7 @@ class ApiFormatTxt extends ApiFormatBase {
        }
 
        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() {
index 9b38208..23ef6b2 100644 (file)
@@ -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 @@ if ( !defined( 'MEDIAWIKI' ) ) {
 class ApiFormatWddx extends ApiFormatBase {
 
        public function __construct( $main, $format ) {
-               parent :: __construct( $main, $format );
+               parent::__construct( $main, $format );
        }
 
        public function getMimeType() {
@@ -53,8 +53,8 @@ class ApiFormatWddx extends ApiFormatBase {
                } 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 @@ class ApiFormatWddx extends ApiFormatBase {
         * 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 @@ class ApiFormatWddx extends ApiFormatBase {
                                        // 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 @@ class ApiFormatWddx extends ApiFormatBase {
                                        $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() {