/** @var string */
private $mModuleName, $mModulePrefix;
private $mSlaveDB = null;
- private $mParamCache = array();
+ private $mParamCache = [];
/** @var array|null|bool */
private $mModuleSource = false;
*/
protected function getExamplesMessages() {
// Fall back to old non-localised method
- $ret = array();
+ $ret = [];
$examples = $this->getExamples();
if ( $examples ) {
if ( !is_array( $examples ) ) {
- $examples = array( $examples );
+ $examples = [ $examples ];
} elseif ( $examples && ( count( $examples ) & 1 ) == 0 &&
array_keys( $examples ) === range( 0, count( $examples ) - 1 ) &&
!preg_match( '/^\s*api\.php\?/', $examples[0] )
) {
// Fix up the ugly "even numbered elements are description, odd
// numbered elemts are the link" format (see doc for self::getExamples)
- $tmp = array();
+ $tmp = [];
$examplesCount = count( $examples );
for ( $i = 0; $i < $examplesCount; $i += 2 ) {
$tmp[$examples[$i + 1]] = $examples[$i];
$qs = $k;
$msg = self::escapeWikiText( $v );
if ( is_array( $msg ) ) {
- $msg = join( " ", $msg );
+ $msg = implode( ' ', $msg );
}
}
$qs = preg_replace( '/^\s*api\.php\?/', '', $qs );
- $ret[$qs] = $this->msg( 'api-help-fallback-example', array( $msg ) );
+ $ret[$qs] = $this->msg( 'api-help-fallback-example', [ $msg ] );
}
}
* @return string|array
*/
public function getHelpUrls() {
- return array();
+ return [];
}
/**
protected function getAllowedParams( /* $flags = 0 */ ) {
// int $flags is not declared because it causes "Strict standards"
// warning. Most derived classes do not implement it.
- return array();
+ return [];
}
/**
$parent = $module;
$manager = $parent->getModuleManager();
if ( $manager === null ) {
- $errorPath = join( '+', array_slice( $parts, 0, $i ) );
+ $errorPath = implode( '+', array_slice( $parts, 0, $i ) );
$this->dieUsage( "The module \"$errorPath\" has no submodules", 'badmodule' );
}
$module = $manager->getModule( $parts[$i] );
if ( $module === null ) {
- $errorPath = $i ? join( '+', array_slice( $parts, 0, $i ) ) : $parent->getModuleName();
+ $errorPath = $i ? implode( '+', array_slice( $parts, 0, $i ) ) : $parent->getModuleName();
$this->dieUsage(
"The module \"$errorPath\" does not have a submodule \"{$parts[$i]}\"",
'badmodule'
// Cache parameters, for performance and to avoid bug 24564.
if ( !isset( $this->mParamCache[$parseLimit] ) ) {
$params = $this->getFinalParams();
- $results = array();
+ $results = [];
if ( $params ) { // getFinalParams() can return false
foreach ( $params as $paramName => $paramSettings ) {
* @return mixed Parameter value
*/
protected function getParameter( $paramName, $parseLimit = true ) {
- $params = $this->getFinalParams();
- $paramSettings = $params[$paramName];
+ $paramSettings = $this->getFinalParams()[$paramName];
return $this->getParameterFromSettings( $paramName, $paramSettings, $parseLimit );
}
$p = $this->getModulePrefix();
$intersection = array_intersect( array_keys( array_filter( $params,
- array( $this, "parameterNotEmpty" ) ) ), $required );
+ [ $this, 'parameterNotEmpty' ] ) ), $required );
if ( count( $intersection ) > 1 ) {
$this->dieUsage(
$p = $this->getModulePrefix();
$intersection = array_intersect( array_keys( array_filter( $params,
- array( $this, "parameterNotEmpty" ) ) ), $required );
+ [ $this, 'parameterNotEmpty' ] ) ), $required );
if ( count( $intersection ) > 1 ) {
$this->dieUsage(
$p = $this->getModulePrefix();
$intersection = array_intersect(
- array_keys( array_filter( $params, array( $this, "parameterNotEmpty" ) ) ),
+ array_keys( array_filter( $params, [ $this, 'parameterNotEmpty' ] ) ),
$required
);
if ( isset( $params['title'] ) ) {
$titleObj = Title::newFromText( $params['title'] );
if ( !$titleObj || $titleObj->isExternal() ) {
- $this->dieUsageMsg( array( 'invalidtitle', $params['title'] ) );
+ $this->dieUsageMsg( [ 'invalidtitle', $params['title'] ] );
}
if ( !$titleObj->canExist() ) {
$this->dieUsage( "Namespace doesn't allow actual pages", 'pagecannotexist' );
}
$pageObj = WikiPage::newFromID( $params['pageid'], $load );
if ( !$pageObj ) {
- $this->dieUsageMsg( array( 'nosuchpageid', $params['pageid'] ) );
+ $this->dieUsageMsg( [ 'nosuchpageid', $params['pageid'] ] );
}
}
*/
protected function getWatchlistValue( $watchlist, $titleObj, $userOption = null ) {
- $userWatching = $this->getUser()->isWatched( $titleObj, WatchedItem::IGNORE_USER_RIGHTS );
+ $userWatching = $this->getUser()->isWatched( $titleObj, User::IGNORE_USER_RIGHTS );
switch ( $watchlist ) {
case 'watch':
ApiBase::dieDebug(
__METHOD__,
"Boolean param $encParamName's default is set to '$default'. " .
- "Boolean parameters must default to false."
+ 'Boolean parameters must default to false.'
);
}
if ( $value !== null ) {
$this->dieUsage(
"File upload param $encParamName is not a file upload; " .
- "be sure to use multipart/form-data for your POST and include " .
- "a filename in the Content-Disposition header.",
+ 'be sure to use multipart/form-data for your POST and include ' .
+ 'a filename in the Content-Disposition header.',
"badupload_{$encParamName}"
);
}
case 'text':
case 'password':
if ( $required && $value === '' ) {
- $this->dieUsageMsg( array( 'missingparam', $paramName ) );
+ $this->dieUsageMsg( [ 'missingparam', $paramName ] );
}
break;
case 'integer': // Force everything using intval() and optionally validate limits
case 'tags':
// If change tagging was requested, check that the tags are valid.
if ( !is_array( $value ) && !$multi ) {
- $value = array( $value );
+ $value = [ $value ];
}
$tagsStatus = ChangeTags::canAddTagsAccompanyingChange( $value );
if ( !$tagsStatus->isGood() ) {
$this->logFeatureUsage( $feature );
}
} elseif ( $required ) {
- $this->dieUsageMsg( array( 'missingparam', $paramName ) );
+ $this->dieUsageMsg( [ 'missingparam', $paramName ] );
}
return $value;
*/
protected function parseMultiValue( $valueName, $value, $allowMultiple, $allowedValues ) {
if ( trim( $value ) === '' && $allowMultiple ) {
- return array();
+ return [];
}
// This is a bit awkward, but we want to avoid calling canApiHighLimits()
if ( count( $unknown ) ) {
if ( $allowMultiple ) {
$s = count( $unknown ) > 1 ? 's' : '';
- $vals = implode( ", ", $unknown );
+ $vals = implode( ', ', $unknown );
$this->setWarning( "Unrecognized value$s for parameter '$valueName': $vals" );
} else {
$this->dieUsage(
if ( is_array( $v ) ) {
return array_map( 'self::escapeWikiText', $v );
} else {
- return strtr( $v, array(
+ return strtr( $v, [
'__' => '__', '{' => '{', '}' => '}',
'[[Category:' => '[[:Category:',
'[[File:' => '[[:File:', '[[Image:' => '[[:Image:',
- ) );
+ ] );
}
}
'Your IP address has been blocked automatically, because it was used by a blocked user',
'autoblocked',
0,
- array( 'blockinfo' => ApiQueryUserInfo::getBlockInfo( $block ) )
+ [ 'blockinfo' => ApiQueryUserInfo::getBlockInfo( $block ) ]
);
} else {
$this->dieUsage(
'You have been blocked from editing',
'blocked',
0,
- array( 'blockinfo' => ApiQueryUserInfo::getBlockInfo( $block ) )
+ [ 'blockinfo' => ApiQueryUserInfo::getBlockInfo( $block ) ]
);
}
}
}
if ( !$errors ) {
// Still no errors? Punt
- $errors = array( array( 'unknownerror-nocode' ) );
+ $errors = [ [ 'unknownerror-nocode' ] ];
}
// Cannot use dieUsageMsg() because extensions might return custom
$code = ApiBase::$messageMap[$code]['code'];
}
- return array( $code, $msg->inLanguage( 'en' )->useDatabase( false )->plain() );
+ return [ $code, $msg->inLanguage( 'en' )->useDatabase( false )->plain() ];
}
/**
/**
* Array that maps message keys to error messages. $1 and friends are replaced.
*/
- public static $messageMap = array(
+ public static $messageMap = [
// This one MUST be present, or dieUsageMsg() will recurse infinitely
- 'unknownerror' => array( 'code' => 'unknownerror', 'info' => "Unknown error: \"\$1\"" ),
- 'unknownerror-nocode' => array( 'code' => 'unknownerror', 'info' => 'Unknown error' ),
+ 'unknownerror' => [ 'code' => 'unknownerror', 'info' => "Unknown error: \"\$1\"" ],
+ 'unknownerror-nocode' => [ 'code' => 'unknownerror', 'info' => 'Unknown error' ],
// Messages from Title::getUserPermissionsErrors()
- 'ns-specialprotected' => array(
+ 'ns-specialprotected' => [
'code' => 'unsupportednamespace',
'info' => "Pages in the Special namespace can't be edited"
- ),
- 'protectedinterface' => array(
+ ],
+ 'protectedinterface' => [
'code' => 'protectednamespace-interface',
'info' => "You're not allowed to edit interface messages"
- ),
- 'namespaceprotected' => array(
+ ],
+ 'namespaceprotected' => [
'code' => 'protectednamespace',
'info' => "You're not allowed to edit pages in the \"\$1\" namespace"
- ),
- 'customcssprotected' => array(
+ ],
+ 'customcssprotected' => [
'code' => 'customcssprotected',
'info' => "You're not allowed to edit custom CSS pages"
- ),
- 'customjsprotected' => array(
+ ],
+ 'customjsprotected' => [
'code' => 'customjsprotected',
'info' => "You're not allowed to edit custom JavaScript pages"
- ),
- 'cascadeprotected' => array(
+ ],
+ 'cascadeprotected' => [
'code' => 'cascadeprotected',
'info' => "The page you're trying to edit is protected because it's included in a cascade-protected page"
- ),
- 'protectedpagetext' => array(
+ ],
+ 'protectedpagetext' => [
'code' => 'protectedpage',
'info' => "The \"\$1\" right is required to edit this page"
- ),
- 'protect-cantedit' => array(
+ ],
+ 'protect-cantedit' => [
'code' => 'cantedit',
'info' => "You can't protect this page because you can't edit it"
- ),
- 'deleteprotected' => array(
+ ],
+ 'deleteprotected' => [
'code' => 'cantedit',
'info' => "You can't delete this page because it has been protected"
- ),
- 'badaccess-group0' => array(
+ ],
+ 'badaccess-group0' => [
'code' => 'permissiondenied',
- 'info' => "Permission denied"
- ), // Generic permission denied message
- 'badaccess-groups' => array(
+ 'info' => 'Permission denied'
+ ], // Generic permission denied message
+ 'badaccess-groups' => [
'code' => 'permissiondenied',
- 'info' => "Permission denied"
- ),
- 'titleprotected' => array(
+ 'info' => 'Permission denied'
+ ],
+ 'titleprotected' => [
'code' => 'protectedtitle',
- 'info' => "This title has been protected from creation"
- ),
- 'nocreate-loggedin' => array(
+ 'info' => 'This title has been protected from creation'
+ ],
+ 'nocreate-loggedin' => [
'code' => 'cantcreate',
'info' => "You don't have permission to create new pages"
- ),
- 'nocreatetext' => array(
+ ],
+ 'nocreatetext' => [
'code' => 'cantcreate-anon',
'info' => "Anonymous users can't create new pages"
- ),
- 'movenologintext' => array(
+ ],
+ 'movenologintext' => [
'code' => 'cantmove-anon',
'info' => "Anonymous users can't move pages"
- ),
- 'movenotallowed' => array(
+ ],
+ 'movenotallowed' => [
'code' => 'cantmove',
'info' => "You don't have permission to move pages"
- ),
- 'confirmedittext' => array(
+ ],
+ 'confirmedittext' => [
'code' => 'confirmemail',
- 'info' => "You must confirm your email address before you can edit"
- ),
- 'blockedtext' => array(
+ 'info' => 'You must confirm your email address before you can edit'
+ ],
+ 'blockedtext' => [
'code' => 'blocked',
- 'info' => "You have been blocked from editing"
- ),
- 'autoblockedtext' => array(
+ 'info' => 'You have been blocked from editing'
+ ],
+ 'autoblockedtext' => [
'code' => 'autoblocked',
- 'info' => "Your IP address has been blocked automatically, because it was used by a blocked user"
- ),
+ 'info' => 'Your IP address has been blocked automatically, because it was used by a blocked user'
+ ],
// Miscellaneous interface messages
- 'actionthrottledtext' => array(
+ 'actionthrottledtext' => [
'code' => 'ratelimited',
'info' => "You've exceeded your rate limit. Please wait some time and try again"
- ),
- 'alreadyrolled' => array(
+ ],
+ 'alreadyrolled' => [
'code' => 'alreadyrolled',
- 'info' => "The page you tried to rollback was already rolled back"
- ),
- 'cantrollback' => array(
+ 'info' => 'The page you tried to rollback was already rolled back'
+ ],
+ 'cantrollback' => [
'code' => 'onlyauthor',
- 'info' => "The page you tried to rollback only has one author"
- ),
- 'readonlytext' => array(
+ 'info' => 'The page you tried to rollback only has one author'
+ ],
+ 'readonlytext' => [
'code' => 'readonly',
- 'info' => "The wiki is currently in read-only mode"
- ),
- 'sessionfailure' => array(
+ 'info' => 'The wiki is currently in read-only mode'
+ ],
+ 'sessionfailure' => [
'code' => 'badtoken',
- 'info' => "Invalid token" ),
- 'cannotdelete' => array(
+ 'info' => 'Invalid token' ],
+ 'cannotdelete' => [
'code' => 'cantdelete',
'info' => "Couldn't delete \"\$1\". Maybe it was deleted already by someone else"
- ),
- 'notanarticle' => array(
+ ],
+ 'notanarticle' => [
'code' => 'missingtitle',
'info' => "The page you requested doesn't exist"
- ),
- 'selfmove' => array( 'code' => 'selfmove', 'info' => "Can't move a page to itself"
- ),
- 'immobile_namespace' => array(
+ ],
+ 'selfmove' => [ 'code' => 'selfmove', 'info' => "Can't move a page to itself"
+ ],
+ 'immobile_namespace' => [
'code' => 'immobilenamespace',
- 'info' => "You tried to move pages from or to a namespace that is protected from moving"
- ),
- 'articleexists' => array(
+ 'info' => 'You tried to move pages from or to a namespace that is protected from moving'
+ ],
+ 'articleexists' => [
'code' => 'articleexists',
- 'info' => "The destination article already exists and is not a redirect to the source article"
- ),
- 'protectedpage' => array(
+ 'info' => 'The destination article already exists and is not a redirect to the source article'
+ ],
+ 'protectedpage' => [
'code' => 'protectedpage',
'info' => "You don't have permission to perform this move"
- ),
- 'hookaborted' => array(
+ ],
+ 'hookaborted' => [
'code' => 'hookaborted',
- 'info' => "The modification you tried to make was aborted by an extension hook"
- ),
- 'cantmove-titleprotected' => array(
+ 'info' => 'The modification you tried to make was aborted by an extension hook'
+ ],
+ 'cantmove-titleprotected' => [
'code' => 'protectedtitle',
- 'info' => "The destination article has been protected from creation"
- ),
- 'imagenocrossnamespace' => array(
+ 'info' => 'The destination article has been protected from creation'
+ ],
+ 'imagenocrossnamespace' => [
'code' => 'nonfilenamespace',
'info' => "Can't move a file to a non-file namespace"
- ),
- 'imagetypemismatch' => array(
+ ],
+ 'imagetypemismatch' => [
'code' => 'filetypemismatch',
'info' => "The new file extension doesn't match its type"
- ),
+ ],
// 'badarticleerror' => shouldn't happen
// 'badtitletext' => shouldn't happen
- 'ip_range_invalid' => array( 'code' => 'invalidrange', 'info' => "Invalid IP range" ),
- 'range_block_disabled' => array(
+ 'ip_range_invalid' => [ 'code' => 'invalidrange', 'info' => 'Invalid IP range' ],
+ 'range_block_disabled' => [
'code' => 'rangedisabled',
- 'info' => "Blocking IP ranges has been disabled"
- ),
- 'nosuchusershort' => array(
+ 'info' => 'Blocking IP ranges has been disabled'
+ ],
+ 'nosuchusershort' => [
'code' => 'nosuchuser',
'info' => "The user you specified doesn't exist"
- ),
- 'badipaddress' => array( 'code' => 'invalidip', 'info' => "Invalid IP address specified" ),
- 'ipb_expiry_invalid' => array( 'code' => 'invalidexpiry', 'info' => "Invalid expiry time" ),
- 'ipb_already_blocked' => array(
+ ],
+ 'badipaddress' => [ 'code' => 'invalidip', 'info' => 'Invalid IP address specified' ],
+ 'ipb_expiry_invalid' => [ 'code' => 'invalidexpiry', 'info' => 'Invalid expiry time' ],
+ 'ipb_already_blocked' => [
'code' => 'alreadyblocked',
- 'info' => "The user you tried to block was already blocked"
- ),
- 'ipb_blocked_as_range' => array(
+ 'info' => 'The user you tried to block was already blocked'
+ ],
+ 'ipb_blocked_as_range' => [
'code' => 'blockedasrange',
'info' => "IP address \"\$1\" was blocked as part of range \"\$2\". You can't unblock the IP individually, but you can unblock the range as a whole."
- ),
- 'ipb_cant_unblock' => array(
+ ],
+ 'ipb_cant_unblock' => [
'code' => 'cantunblock',
- 'info' => "The block you specified was not found. It may have been unblocked already"
- ),
- 'mailnologin' => array(
+ 'info' => 'The block you specified was not found. It may have been unblocked already'
+ ],
+ 'mailnologin' => [
'code' => 'cantsend',
- 'info' => "You are not logged in, you do not have a confirmed email address, or you are not allowed to send email to other users, so you cannot send email"
- ),
- 'ipbblocked' => array(
+ 'info' => 'You are not logged in, you do not have a confirmed email address, or you are not allowed to send email to other users, so you cannot send email'
+ ],
+ 'ipbblocked' => [
'code' => 'ipbblocked',
'info' => 'You cannot block or unblock users while you are yourself blocked'
- ),
- 'ipbnounblockself' => array(
+ ],
+ 'ipbnounblockself' => [
'code' => 'ipbnounblockself',
'info' => 'You are not allowed to unblock yourself'
- ),
- 'usermaildisabled' => array(
+ ],
+ 'usermaildisabled' => [
'code' => 'usermaildisabled',
- 'info' => "User email has been disabled"
- ),
- 'blockedemailuser' => array(
+ 'info' => 'User email has been disabled'
+ ],
+ 'blockedemailuser' => [
'code' => 'blockedfrommail',
- 'info' => "You have been blocked from sending email"
- ),
- 'notarget' => array(
+ 'info' => 'You have been blocked from sending email'
+ ],
+ 'notarget' => [
'code' => 'notarget',
- 'info' => "You have not specified a valid target for this action"
- ),
- 'noemail' => array(
+ 'info' => 'You have not specified a valid target for this action'
+ ],
+ 'noemail' => [
'code' => 'noemail',
- 'info' => "The user has not specified a valid email address, or has chosen not to receive email from other users"
- ),
- 'rcpatroldisabled' => array(
+ 'info' => 'The user has not specified a valid email address, or has chosen not to receive email from other users'
+ ],
+ 'rcpatroldisabled' => [
'code' => 'patroldisabled',
- 'info' => "Patrolling is disabled on this wiki"
- ),
- 'markedaspatrollederror-noautopatrol' => array(
+ 'info' => 'Patrolling is disabled on this wiki'
+ ],
+ 'markedaspatrollederror-noautopatrol' => [
'code' => 'noautopatrol',
'info' => "You don't have permission to patrol your own changes"
- ),
- 'delete-toobig' => array(
+ ],
+ 'delete-toobig' => [
'code' => 'bigdelete',
'info' => "You can't delete this page because it has more than \$1 revisions"
- ),
- 'movenotallowedfile' => array(
+ ],
+ 'movenotallowedfile' => [
'code' => 'cantmovefile',
'info' => "You don't have permission to move files"
- ),
- 'userrights-no-interwiki' => array(
+ ],
+ 'userrights-no-interwiki' => [
'code' => 'nointerwikiuserrights',
'info' => "You don't have permission to change user rights on other wikis"
- ),
- 'userrights-nodatabase' => array(
+ ],
+ 'userrights-nodatabase' => [
'code' => 'nosuchdatabase',
'info' => "Database \"\$1\" does not exist or is not local"
- ),
- 'nouserspecified' => array( 'code' => 'invaliduser', 'info' => "Invalid username \"\$1\"" ),
- 'noname' => array( 'code' => 'invaliduser', 'info' => "Invalid username \"\$1\"" ),
- 'summaryrequired' => array( 'code' => 'summaryrequired', 'info' => 'Summary required' ),
- 'import-rootpage-invalid' => array(
+ ],
+ 'nouserspecified' => [ 'code' => 'invaliduser', 'info' => "Invalid username \"\$1\"" ],
+ 'noname' => [ 'code' => 'invaliduser', 'info' => "Invalid username \"\$1\"" ],
+ 'summaryrequired' => [ 'code' => 'summaryrequired', 'info' => 'Summary required' ],
+ 'import-rootpage-invalid' => [
'code' => 'import-rootpage-invalid',
'info' => 'Root page is an invalid title'
- ),
- 'import-rootpage-nosubpage' => array(
+ ],
+ 'import-rootpage-nosubpage' => [
'code' => 'import-rootpage-nosubpage',
'info' => 'Namespace "$1" of the root page does not allow subpages'
- ),
+ ],
// API-specific messages
- 'readrequired' => array(
+ 'readrequired' => [
'code' => 'readapidenied',
- 'info' => "You need read permission to use this module"
- ),
- 'writedisabled' => array(
+ 'info' => 'You need read permission to use this module'
+ ],
+ 'writedisabled' => [
'code' => 'noapiwrite',
'info' => "Editing of this wiki through the API is disabled. Make sure the \$wgEnableWriteAPI=true; statement is included in the wiki's LocalSettings.php file"
- ),
- 'writerequired' => array(
+ ],
+ 'writerequired' => [
'code' => 'writeapidenied',
'info' => "You're not allowed to edit this wiki through the API"
- ),
- 'missingparam' => array( 'code' => 'no$1', 'info' => "The \$1 parameter must be set" ),
- 'invalidtitle' => array( 'code' => 'invalidtitle', 'info' => "Bad title \"\$1\"" ),
- 'nosuchpageid' => array( 'code' => 'nosuchpageid', 'info' => "There is no page with ID \$1" ),
- 'nosuchrevid' => array( 'code' => 'nosuchrevid', 'info' => "There is no revision with ID \$1" ),
- 'nosuchuser' => array( 'code' => 'nosuchuser', 'info' => "User \"\$1\" doesn't exist" ),
- 'invaliduser' => array( 'code' => 'invaliduser', 'info' => "Invalid username \"\$1\"" ),
- 'invalidexpiry' => array( 'code' => 'invalidexpiry', 'info' => "Invalid expiry time \"\$1\"" ),
- 'pastexpiry' => array( 'code' => 'pastexpiry', 'info' => "Expiry time \"\$1\" is in the past" ),
- 'create-titleexists' => array(
+ ],
+ 'missingparam' => [ 'code' => 'no$1', 'info' => "The \$1 parameter must be set" ],
+ 'invalidtitle' => [ 'code' => 'invalidtitle', 'info' => "Bad title \"\$1\"" ],
+ 'nosuchpageid' => [ 'code' => 'nosuchpageid', 'info' => "There is no page with ID \$1" ],
+ 'nosuchrevid' => [ 'code' => 'nosuchrevid', 'info' => "There is no revision with ID \$1" ],
+ 'nosuchuser' => [ 'code' => 'nosuchuser', 'info' => "User \"\$1\" doesn't exist" ],
+ 'invaliduser' => [ 'code' => 'invaliduser', 'info' => "Invalid username \"\$1\"" ],
+ 'invalidexpiry' => [ 'code' => 'invalidexpiry', 'info' => "Invalid expiry time \"\$1\"" ],
+ 'pastexpiry' => [ 'code' => 'pastexpiry', 'info' => "Expiry time \"\$1\" is in the past" ],
+ 'create-titleexists' => [
'code' => 'create-titleexists',
'info' => "Existing titles can't be protected with 'create'"
- ),
- 'missingtitle-createonly' => array(
+ ],
+ 'missingtitle-createonly' => [
'code' => 'missingtitle-createonly',
'info' => "Missing titles can only be protected with 'create'"
- ),
- 'cantblock' => array( 'code' => 'cantblock',
+ ],
+ 'cantblock' => [ 'code' => 'cantblock',
'info' => "You don't have permission to block users"
- ),
- 'canthide' => array(
+ ],
+ 'canthide' => [
'code' => 'canthide',
'info' => "You don't have permission to hide user names from the block log"
- ),
- 'cantblock-email' => array(
+ ],
+ 'cantblock-email' => [
'code' => 'cantblock-email',
'info' => "You don't have permission to block users from sending email through the wiki"
- ),
- 'unblock-notarget' => array(
+ ],
+ 'unblock-notarget' => [
'code' => 'notarget',
- 'info' => "Either the id or the user parameter must be set"
- ),
- 'unblock-idanduser' => array(
+ 'info' => 'Either the id or the user parameter must be set'
+ ],
+ 'unblock-idanduser' => [
'code' => 'idanduser',
'info' => "The id and user parameters can't be used together"
- ),
- 'cantunblock' => array(
+ ],
+ 'cantunblock' => [
'code' => 'permissiondenied',
'info' => "You don't have permission to unblock users"
- ),
- 'cannotundelete' => array(
+ ],
+ 'cannotundelete' => [
'code' => 'cantundelete',
'info' => "Couldn't undelete: the requested revisions may not exist, or may have been undeleted already"
- ),
- 'permdenied-undelete' => array(
+ ],
+ 'permdenied-undelete' => [
'code' => 'permissiondenied',
'info' => "You don't have permission to restore deleted revisions"
- ),
- 'createonly-exists' => array(
+ ],
+ 'createonly-exists' => [
'code' => 'articleexists',
- 'info' => "The article you tried to create has been created already"
- ),
- 'nocreate-missing' => array(
+ 'info' => 'The article you tried to create has been created already'
+ ],
+ 'nocreate-missing' => [
'code' => 'missingtitle',
'info' => "The article you tried to edit doesn't exist"
- ),
- 'cantchangecontentmodel' => array(
+ ],
+ 'cantchangecontentmodel' => [
'code' => 'cantchangecontentmodel',
'info' => "You don't have permission to change the content model of a page"
- ),
- 'nosuchrcid' => array(
+ ],
+ 'nosuchrcid' => [
'code' => 'nosuchrcid',
'info' => "There is no change with rcid \"\$1\""
- ),
- 'nosuchlogid' => array(
+ ],
+ 'nosuchlogid' => [
'code' => 'nosuchlogid',
'info' => "There is no log entry with ID \"\$1\""
- ),
- 'protect-invalidaction' => array(
+ ],
+ 'protect-invalidaction' => [
'code' => 'protect-invalidaction',
'info' => "Invalid protection type \"\$1\""
- ),
- 'protect-invalidlevel' => array(
+ ],
+ 'protect-invalidlevel' => [
'code' => 'protect-invalidlevel',
'info' => "Invalid protection level \"\$1\""
- ),
- 'toofewexpiries' => array(
+ ],
+ 'toofewexpiries' => [
'code' => 'toofewexpiries',
'info' => "\$1 expiry timestamps were provided where \$2 were needed"
- ),
- 'cantimport' => array(
+ ],
+ 'cantimport' => [
'code' => 'cantimport',
'info' => "You don't have permission to import pages"
- ),
- 'cantimport-upload' => array(
+ ],
+ 'cantimport-upload' => [
'code' => 'cantimport-upload',
'info' => "You don't have permission to import uploaded pages"
- ),
- 'importnofile' => array( 'code' => 'nofile', 'info' => "You didn't upload a file" ),
- 'importuploaderrorsize' => array(
+ ],
+ 'importnofile' => [ 'code' => 'nofile', 'info' => "You didn't upload a file" ],
+ 'importuploaderrorsize' => [
'code' => 'filetoobig',
'info' => 'The file you uploaded is bigger than the maximum upload size'
- ),
- 'importuploaderrorpartial' => array(
+ ],
+ 'importuploaderrorpartial' => [
'code' => 'partialupload',
'info' => 'The file was only partially uploaded'
- ),
- 'importuploaderrortemp' => array(
+ ],
+ 'importuploaderrortemp' => [
'code' => 'notempdir',
'info' => 'The temporary upload directory is missing'
- ),
- 'importcantopen' => array(
+ ],
+ 'importcantopen' => [
'code' => 'cantopenfile',
'info' => "Couldn't open the uploaded file"
- ),
- 'import-noarticle' => array(
+ ],
+ 'import-noarticle' => [
'code' => 'badinterwiki',
'info' => 'Invalid interwiki title specified'
- ),
- 'importbadinterwiki' => array(
+ ],
+ 'importbadinterwiki' => [
'code' => 'badinterwiki',
'info' => 'Invalid interwiki title specified'
- ),
- 'import-unknownerror' => array(
+ ],
+ 'import-unknownerror' => [
'code' => 'import-unknownerror',
'info' => "Unknown error on import: \"\$1\""
- ),
- 'cantoverwrite-sharedfile' => array(
+ ],
+ 'cantoverwrite-sharedfile' => [
'code' => 'cantoverwrite-sharedfile',
'info' => 'The target file exists on a shared repository and you do not have permission to override it'
- ),
- 'sharedfile-exists' => array(
+ ],
+ 'sharedfile-exists' => [
'code' => 'fileexists-sharedrepo-perm',
'info' => 'The target file exists on a shared repository. Use the ignorewarnings parameter to override it.'
- ),
- 'mustbeposted' => array(
+ ],
+ 'mustbeposted' => [
'code' => 'mustbeposted',
'info' => "The \$1 module requires a POST request"
- ),
- 'show' => array(
+ ],
+ 'show' => [
'code' => 'show',
'info' => 'Incorrect parameter - mutually exclusive values may not be supplied'
- ),
- 'specialpage-cantexecute' => array(
+ ],
+ 'specialpage-cantexecute' => [
'code' => 'specialpage-cantexecute',
'info' => "You don't have permission to view the results of this special page"
- ),
- 'invalidoldimage' => array(
+ ],
+ 'invalidoldimage' => [
'code' => 'invalidoldimage',
'info' => 'The oldimage parameter has invalid format'
- ),
- 'nodeleteablefile' => array(
+ ],
+ 'nodeleteablefile' => [
'code' => 'nodeleteablefile',
'info' => 'No such old version of the file'
- ),
- 'fileexists-forbidden' => array(
+ ],
+ 'fileexists-forbidden' => [
'code' => 'fileexists-forbidden',
'info' => 'A file with name "$1" already exists, and cannot be overwritten.'
- ),
- 'fileexists-shared-forbidden' => array(
+ ],
+ 'fileexists-shared-forbidden' => [
'code' => 'fileexists-shared-forbidden',
'info' => 'A file with name "$1" already exists in the shared file repository, and cannot be overwritten.'
- ),
- 'filerevert-badversion' => array(
+ ],
+ 'filerevert-badversion' => [
'code' => 'filerevert-badversion',
'info' => 'There is no previous local version of this file with the provided timestamp.'
- ),
+ ],
// ApiEditPage messages
- 'noimageredirect-anon' => array(
+ 'noimageredirect-anon' => [
'code' => 'noimageredirect-anon',
'info' => "Anonymous users can't create image redirects"
- ),
- 'noimageredirect-logged' => array(
+ ],
+ 'noimageredirect-logged' => [
'code' => 'noimageredirect',
'info' => "You don't have permission to create image redirects"
- ),
- 'spamdetected' => array(
+ ],
+ 'spamdetected' => [
'code' => 'spamdetected',
'info' => "Your edit was refused because it contained a spam fragment: \"\$1\""
- ),
- 'contenttoobig' => array(
+ ],
+ 'contenttoobig' => [
'code' => 'contenttoobig',
'info' => "The content you supplied exceeds the article size limit of \$1 kilobytes"
- ),
- 'noedit-anon' => array( 'code' => 'noedit-anon', 'info' => "Anonymous users can't edit pages" ),
- 'noedit' => array( 'code' => 'noedit', 'info' => "You don't have permission to edit pages" ),
- 'wasdeleted' => array(
+ ],
+ 'noedit-anon' => [ 'code' => 'noedit-anon', 'info' => "Anonymous users can't edit pages" ],
+ 'noedit' => [ 'code' => 'noedit', 'info' => "You don't have permission to edit pages" ],
+ 'wasdeleted' => [
'code' => 'pagedeleted',
- 'info' => "The page has been deleted since you fetched its timestamp"
- ),
- 'blankpage' => array(
+ 'info' => 'The page has been deleted since you fetched its timestamp'
+ ],
+ 'blankpage' => [
'code' => 'emptypage',
- 'info' => "Creating new, empty pages is not allowed"
- ),
- 'editconflict' => array( 'code' => 'editconflict', 'info' => "Edit conflict detected" ),
- 'hashcheckfailed' => array( 'code' => 'badmd5', 'info' => "The supplied MD5 hash was incorrect" ),
- 'missingtext' => array(
+ 'info' => 'Creating new, empty pages is not allowed'
+ ],
+ 'editconflict' => [ 'code' => 'editconflict', 'info' => 'Edit conflict detected' ],
+ 'hashcheckfailed' => [ 'code' => 'badmd5', 'info' => 'The supplied MD5 hash was incorrect' ],
+ 'missingtext' => [
'code' => 'notext',
- 'info' => "One of the text, appendtext, prependtext and undo parameters must be set"
- ),
- 'emptynewsection' => array(
+ 'info' => 'One of the text, appendtext, prependtext and undo parameters must be set'
+ ],
+ 'emptynewsection' => [
'code' => 'emptynewsection',
'info' => 'Creating empty new sections is not possible.'
- ),
- 'revwrongpage' => array(
+ ],
+ 'revwrongpage' => [
'code' => 'revwrongpage',
'info' => "r\$1 is not a revision of \"\$2\""
- ),
- 'undo-failure' => array(
+ ],
+ 'undo-failure' => [
'code' => 'undofailure',
'info' => 'Undo failed due to conflicting intermediate edits'
- ),
- 'content-not-allowed-here' => array(
+ ],
+ 'content-not-allowed-here' => [
'code' => 'contentnotallowedhere',
'info' => 'Content model "$1" is not allowed at title "$2"'
- ),
+ ],
- // Messages from WikiPage::doEit()
- 'edit-hook-aborted' => array(
+ // Messages from WikiPage::doEit(]
+ 'edit-hook-aborted' => [
'code' => 'edit-hook-aborted',
- 'info' => "Your edit was aborted by an ArticleSave hook"
- ),
- 'edit-gone-missing' => array(
+ 'info' => 'Your edit was aborted by an ArticleSave hook'
+ ],
+ 'edit-gone-missing' => [
'code' => 'edit-gone-missing',
'info' => "The page you tried to edit doesn't seem to exist anymore"
- ),
- 'edit-conflict' => array( 'code' => 'editconflict', 'info' => "Edit conflict detected" ),
- 'edit-already-exists' => array(
+ ],
+ 'edit-conflict' => [ 'code' => 'editconflict', 'info' => 'Edit conflict detected' ],
+ 'edit-already-exists' => [
'code' => 'edit-already-exists',
'info' => 'It seems the page you tried to create already exist'
- ),
+ ],
// uploadMsgs
- 'invalid-file-key' => array( 'code' => 'invalid-file-key', 'info' => 'Not a valid file key' ),
- 'nouploadmodule' => array( 'code' => 'nouploadmodule', 'info' => 'No upload module set' ),
- 'uploaddisabled' => array(
+ 'invalid-file-key' => [ 'code' => 'invalid-file-key', 'info' => 'Not a valid file key' ],
+ 'nouploadmodule' => [ 'code' => 'nouploadmodule', 'info' => 'No upload module set' ],
+ 'uploaddisabled' => [
'code' => 'uploaddisabled',
'info' => 'Uploads are not enabled. Make sure $wgEnableUploads is set to true in LocalSettings.php and the PHP ini setting file_uploads is true'
- ),
- 'copyuploaddisabled' => array(
+ ],
+ 'copyuploaddisabled' => [
'code' => 'copyuploaddisabled',
'info' => 'Uploads by URL is not enabled. Make sure $wgAllowCopyUploads is set to true in LocalSettings.php.'
- ),
- 'copyuploadbaddomain' => array(
+ ],
+ 'copyuploadbaddomain' => [
'code' => 'copyuploadbaddomain',
'info' => 'Uploads by URL are not allowed from this domain.'
- ),
- 'copyuploadbadurl' => array(
+ ],
+ 'copyuploadbadurl' => [
'code' => 'copyuploadbadurl',
'info' => 'Upload not allowed from this URL.'
- ),
+ ],
- 'filename-tooshort' => array(
+ 'filename-tooshort' => [
'code' => 'filename-tooshort',
'info' => 'The filename is too short'
- ),
- 'filename-toolong' => array( 'code' => 'filename-toolong', 'info' => 'The filename is too long' ),
- 'illegal-filename' => array(
+ ],
+ 'filename-toolong' => [ 'code' => 'filename-toolong', 'info' => 'The filename is too long' ],
+ 'illegal-filename' => [
'code' => 'illegal-filename',
'info' => 'The filename is not allowed'
- ),
- 'filetype-missing' => array(
+ ],
+ 'filetype-missing' => [
'code' => 'filetype-missing',
'info' => 'The file is missing an extension'
- ),
+ ],
- 'mustbeloggedin' => array( 'code' => 'mustbeloggedin', 'info' => 'You must be logged in to $1.' )
- );
+ 'mustbeloggedin' => [ 'code' => 'mustbeloggedin', 'info' => 'You must be logged in to $1.' ]
+ ];
// @codingStandardsIgnoreEnd
/**
* @throws UsageException always
*/
public function dieReadOnly() {
- $parsed = $this->parseMsg( array( 'readonlytext' ) );
+ $parsed = $this->parseMsg( [ 'readonlytext' ] );
$this->dieUsage( $parsed['info'], $parsed['code'], /* http error */ 0,
- array( 'readonlyreason' => wfReadOnlyReason() ) );
+ [ 'readonlyreason' => wfReadOnlyReason() ] );
}
/**
# most of the time we send a 1 element, so we might as well send it as
# a string and make this an array here.
if ( is_string( $error ) ) {
- $error = array( $error );
+ $error = [ $error ];
}
$parsed = $this->parseMsg( $error );
$extraData = isset( $parsed['data'] ) ? $parsed['data'] : null;
}
if ( is_string( $error ) ) {
- $error = array( $error );
+ $error = [ $error ];
}
$parsed = $this->parseMsg( $error );
$this->setWarning( '$wgDebugAPI: ' . $parsed['code'] . ' - ' . $parsed['info'] );
}
if ( $key instanceof IApiMessage ) {
- return array(
+ return [
'code' => $key->getApiCode(),
'info' => $key->inLanguage( 'en' )->useDatabase( false )->text(),
'data' => $key->getApiData()
- );
+ ];
}
if ( isset( self::$messageMap[$key] ) ) {
- return array(
+ return [
'code' => wfMsgReplaceArgs( self::$messageMap[$key]['code'], $error ),
'info' => wfMsgReplaceArgs( self::$messageMap[$key]['info'], $error )
- );
+ ];
}
// If the key isn't present, throw an "unknown error"
- return $this->parseMsg( array( 'unknownerror', $key ) );
+ return $this->parseMsg( [ 'unknownerror', $key ] );
}
/**
*/
public function getFinalDescription() {
$desc = $this->getDescription();
- Hooks::run( 'APIGetDescription', array( &$this, &$desc ) );
+ Hooks::run( 'APIGetDescription', [ &$this, &$desc ] );
$desc = self::escapeWikiText( $desc );
if ( is_array( $desc ) ) {
- $desc = join( "\n", $desc );
+ $desc = implode( "\n", $desc );
} else {
$desc = (string)$desc;
}
- $msg = ApiBase::makeMessage( $this->getDescriptionMessage(), $this->getContext(), array(
+ $msg = ApiBase::makeMessage( $this->getDescriptionMessage(), $this->getContext(), [
$this->getModulePrefix(),
$this->getModuleName(),
$this->getModulePath(),
- ) );
+ ] );
if ( !$msg->exists() ) {
$msg = $this->msg( 'api-help-fallback-description', $desc );
}
- $msgs = array( $msg );
+ $msgs = [ $msg ];
- Hooks::run( 'APIGetDescriptionMessages', array( $this, &$msgs ) );
+ Hooks::run( 'APIGetDescriptionMessages', [ $this, &$msgs ] );
return $msgs;
}
public function getFinalParams( $flags = 0 ) {
$params = $this->getAllowedParams( $flags );
if ( !$params ) {
- $params = array();
+ $params = [];
}
if ( $this->needsToken() ) {
- $params['token'] = array(
+ $params['token'] = [
ApiBase::PARAM_TYPE => 'string',
ApiBase::PARAM_REQUIRED => true,
- ApiBase::PARAM_HELP_MSG => array(
+ ApiBase::PARAM_HELP_MSG => [
'api-help-param-token',
$this->needsToken(),
- ),
- ) + ( isset( $params['token'] ) ? $params['token'] : array() );
+ ],
+ ] + ( isset( $params['token'] ) ? $params['token'] : [] );
}
- Hooks::run( 'APIGetAllowedParams', array( &$this, &$params, $flags ) );
+ Hooks::run( 'APIGetAllowedParams', [ &$this, &$params, $flags ] );
return $params;
}
$path = $this->getModulePath();
$desc = $this->getParamDescription();
- Hooks::run( 'APIGetParamDescription', array( &$this, &$desc ) );
+ Hooks::run( 'APIGetParamDescription', [ &$this, &$desc ] );
if ( !$desc ) {
- $desc = array();
+ $desc = [];
}
$desc = self::escapeWikiText( $desc );
$params = $this->getFinalParams( ApiBase::GET_VALUES_FOR_HELP );
- $msgs = array();
+ $msgs = [];
foreach ( $params as $param => $settings ) {
if ( !is_array( $settings ) ) {
- $settings = array();
+ $settings = [];
}
$d = isset( $desc[$param] ) ? $desc[$param] : '';
}
return $line;
}, $d );
- $d = join( ' ', $d );
+ $d = implode( ' ', $d );
}
if ( isset( $settings[ApiBase::PARAM_HELP_MSG] ) ) {
}
}
$msg = ApiBase::makeMessage( $msg, $this->getContext(),
- array( $prefix, $param, $name, $path ) );
+ [ $prefix, $param, $name, $path ] );
if ( !$msg ) {
- $this->dieDebug( __METHOD__,
+ self::dieDebug( __METHOD__,
'Value in ApiBase::PARAM_HELP_MSG is not valid' );
}
- $msgs[$param] = array( $msg );
+ $msgs[$param] = [ $msg ];
if ( isset( $settings[ApiBase::PARAM_HELP_MSG_PER_VALUE] ) ) {
if ( !is_array( $settings[ApiBase::PARAM_HELP_MSG_PER_VALUE] ) ) {
- $this->dieDebug( __METHOD__,
+ self::dieDebug( __METHOD__,
'ApiBase::PARAM_HELP_MSG_PER_VALUE is not valid' );
}
if ( !is_array( $settings[ApiBase::PARAM_TYPE] ) ) {
- $this->dieDebug( __METHOD__,
+ self::dieDebug( __METHOD__,
'ApiBase::PARAM_HELP_MSG_PER_VALUE may only be used when ' .
'ApiBase::PARAM_TYPE is an array' );
}
$msg = "apihelp-{$path}-paramvalue-{$param}-{$value}";
}
$m = ApiBase::makeMessage( $msg, $this->getContext(),
- array( $prefix, $param, $name, $path, $value ) );
+ [ $prefix, $param, $name, $path, $value ] );
if ( $m ) {
$m = new ApiHelpParamValueMessage(
$value,
- array( $m->getKey(), 'api-help-param-no-description' ),
+ [ $m->getKey(), 'api-help-param-no-description' ],
$m->getParams()
);
$msgs[$param][] = $m->setContext( $this->getContext() );
} else {
- $this->dieDebug( __METHOD__,
+ self::dieDebug( __METHOD__,
"Value in ApiBase::PARAM_HELP_MSG_PER_VALUE for $value is not valid" );
}
}
if ( isset( $settings[ApiBase::PARAM_HELP_MSG_APPEND] ) ) {
if ( !is_array( $settings[ApiBase::PARAM_HELP_MSG_APPEND] ) ) {
- $this->dieDebug( __METHOD__,
+ self::dieDebug( __METHOD__,
'Value for ApiBase::PARAM_HELP_MSG_APPEND is not an array' );
}
foreach ( $settings[ApiBase::PARAM_HELP_MSG_APPEND] as $m ) {
$m = ApiBase::makeMessage( $m, $this->getContext(),
- array( $prefix, $param, $name, $path ) );
+ [ $prefix, $param, $name, $path ] );
if ( $m ) {
$msgs[$param][] = $m;
} else {
- $this->dieDebug( __METHOD__,
+ self::dieDebug( __METHOD__,
'Value in ApiBase::PARAM_HELP_MSG_APPEND is not valid' );
}
}
}
}
- Hooks::run( 'APIGetParamDescriptionMessages', array( $this, &$msgs ) );
+ Hooks::run( 'APIGetParamDescriptionMessages', [ $this, &$msgs ] );
return $msgs;
}
* @return string[]
*/
protected function getHelpFlags() {
- $flags = array();
+ $flags = [];
if ( $this->isDeprecated() ) {
$flags[] = 'deprecated';
// Build map of extension directories to extension info
if ( self::$extensionInfo === null ) {
- self::$extensionInfo = array(
- realpath( __DIR__ ) ?: __DIR__ => array(
+ self::$extensionInfo = [
+ realpath( __DIR__ ) ?: __DIR__ => [
'path' => $IP,
'name' => 'MediaWiki',
'license-name' => 'GPL-2.0+',
- ),
+ ],
realpath( "$IP/extensions" ) ?: "$IP/extensions" => null,
- );
- $keep = array(
+ ];
+ $keep = [
'path' => null,
'name' => null,
'namemsg' => null,
'license-name' => null,
- );
+ ];
foreach ( $this->getConfig()->get( 'ExtensionCredits' ) as $group ) {
foreach ( $group as $ext ) {
if ( !isset( $ext['path'] ) || !isset( $ext['name'] ) ) {
*/
public function getFinalResultProperties() {
wfDeprecated( __METHOD__, '1.24' );
- return array();
+ return [];
}
/**
*/
public function getRequireOnlyOneParameterErrorMessages( $params ) {
wfDeprecated( __METHOD__, '1.24' );
- return array();
+ return [];
}
/**
*/
public function getRequireMaxOneParameterErrorMessages( $params ) {
wfDeprecated( __METHOD__, '1.24' );
- return array();
+ return [];
}
/**
*/
public function getRequireAtLeastOneParameterErrorMessages( $params ) {
wfDeprecated( __METHOD__, '1.24' );
- return array();
+ return [];
}
/**
*/
public function getTitleOrPageIdErrorMessage() {
wfDeprecated( __METHOD__, '1.24' );
- return array();
+ return [];
}
/**
*/
public function getPossibleErrors() {
wfDeprecated( __METHOD__, '1.24' );
- return array();
+ return [];
}
/**
*/
public function getFinalPossibleErrors() {
wfDeprecated( __METHOD__, '1.24' );
- return array();
+ return [];
}
/**
*/
public function parseErrors( $errors ) {
wfDeprecated( __METHOD__, '1.24' );
- return array();
+ return [];
}
/**
* @return array|bool False on no parameter descriptions
*/
protected function getParamDescription() {
- return array();
+ return [];
}
/**
if ( $msg !== false ) {
if ( !is_array( $msg ) ) {
- $msg = array(
+ $msg = [
$msg
- );
+ ];
}
$msg = $lnPrfx . implode( $lnPrfx, $msg ) . "\n";
$examples = $this->getExamples();
if ( $examples ) {
if ( !is_array( $examples ) ) {
- $examples = array(
+ $examples = [
$examples
- );
+ ];
}
- $msg .= "Example" . ( count( $examples ) > 1 ? 's' : '' ) . ":\n";
+ $msg .= 'Example' . ( count( $examples ) > 1 ? 's' : '' ) . ":\n";
foreach ( $examples as $k => $v ) {
if ( is_numeric( $k ) ) {
$msg .= " $v\n";
} else {
if ( is_array( $v ) ) {
- $msgExample = implode( "\n", array_map( array( $this, 'indentExampleText' ), $v ) );
+ $msgExample = implode( "\n", array_map( [ $this, 'indentExampleText' ], $v ) );
} else {
$msgExample = " $v";
}
- $msgExample .= ":";
+ $msgExample .= ':';
$msg .= wordwrap( $msgExample, 100, "\n" ) . "\n $k\n";
}
}
* @return string
*/
private function indentExampleText( $item ) {
- return " " . $item;
+ return ' ' . $item;
}
/**
return '';
}
if ( !is_array( $input ) ) {
- $input = array( $input );
+ $input = [ $input ];
}
if ( count( $input ) > 0 ) {
// handle shorthand
if ( !is_array( $paramSettings ) ) {
- $paramSettings = array(
+ $paramSettings = [
self::PARAM_DFLT => $paramSettings,
- );
+ ];
}
// handle missing type
if ( isset( $paramSettings[self::PARAM_REQUIRED] )
&& $paramSettings[self::PARAM_REQUIRED]
) {
- $desc .= $paramPrefix . "This parameter is required";
+ $desc .= $paramPrefix . 'This parameter is required';
}
$type = isset( $paramSettings[self::PARAM_TYPE] )
sort( $type );
}
if ( is_array( $type ) ) {
- $choices = array();
+ $choices = [];
$nothingPrompt = '';
foreach ( $type as $t ) {
if ( $t === '' ) {
}
break;
case 'upload':
- $desc .= $paramPrefix . "Must be posted as a file upload using multipart/form-data";
+ $desc .= $paramPrefix . 'Must be posted as a file upload using multipart/form-data';
break;
}
}
if ( !$isArray
|| $isArray && count( $type ) > self::LIMIT_SML1
) {
- $desc .= $paramPrefix . "Maximum number of values " .
- self::LIMIT_SML1 . " (" . self::LIMIT_SML2 . " for bots)";
+ $desc .= $paramPrefix . 'Maximum number of values ' .
+ self::LIMIT_SML1 . ' (' . self::LIMIT_SML2 . ' for bots)';
}
}
}