X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fapi%2FApiFormatJson.php;h=36cbbd985a9e02a82ffb2c6c17f05b7b20c9e7bc;hb=953932c621f24efc06760c430fdbadce21e8767b;hp=be1b12c358b0cd131fc36d2c6e83000030bb897d;hpb=8aafaa30dfc52cfad806f6ad0da32b78ca473704;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/api/ApiFormatJson.php b/includes/api/ApiFormatJson.php index be1b12c358..36cbbd985a 100644 --- a/includes/api/ApiFormatJson.php +++ b/includes/api/ApiFormatJson.php @@ -71,29 +71,30 @@ class ApiFormatJson extends ApiFormatBase { $opt = 0; if ( $this->isRaw ) { $opt |= FormatJson::ALL_OK; - $transform = array(); + $transform = []; } else { switch ( $params['formatversion'] ) { case 1: $opt |= $params['utf8'] ? FormatJson::ALL_OK : FormatJson::XMLMETA_OK; - $transform = array( - 'BC' => array(), - 'Types' => array( 'AssocAsObject' => true ), + $transform = [ + 'BC' => [], + 'Types' => [ 'AssocAsObject' => true ], 'Strip' => 'all', - ); + ]; break; case 2: case 'latest': $opt |= $params['ascii'] ? FormatJson::XMLMETA_OK : FormatJson::ALL_OK; - $transform = array( - 'Types' => array( 'AssocAsObject' => true ), + $transform = [ + 'Types' => [ 'AssocAsObject' => true ], 'Strip' => 'all', - ); + ]; break; default: - $this->dieUsage( __METHOD__ . ': Unknown value for \'formatversion\'', 'unknownformatversion' ); + $this->dieUsage( __METHOD__ . + ': Unknown value for \'formatversion\'', 'unknownformatversion' ); } } $data = $this->getResult()->getResultData( null, $transform ); @@ -120,27 +121,27 @@ class ApiFormatJson extends ApiFormatBase { public function getAllowedParams() { if ( $this->isRaw ) { - return array(); + return parent::getAllowedParams(); } - $ret = array( - 'callback' => array( + $ret = parent::getAllowedParams() + [ + 'callback' => [ ApiBase::PARAM_HELP_MSG => 'apihelp-json-param-callback', - ), - 'utf8' => array( + ], + 'utf8' => [ ApiBase::PARAM_DFLT => false, ApiBase::PARAM_HELP_MSG => 'apihelp-json-param-utf8', - ), - 'ascii' => array( + ], + 'ascii' => [ ApiBase::PARAM_DFLT => false, ApiBase::PARAM_HELP_MSG => 'apihelp-json-param-ascii', - ), - 'formatversion' => array( - ApiBase::PARAM_TYPE => array( 1, 2, 'latest' ), + ], + 'formatversion' => [ + ApiBase::PARAM_TYPE => [ 1, 2, 'latest' ], ApiBase::PARAM_DFLT => 1, ApiBase::PARAM_HELP_MSG => 'apihelp-json-param-formatversion', - ), - ); + ], + ]; return $ret; } }