X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fapi%2FApiEmailUser.php;h=192378e8e871aedfa65cfcd823cda03c19435312;hb=724b2cf91205cc1b09c5677a8c01e34978717d4a;hp=15eb475e73c8be418efbe4fcaf1f2a1f202e9aba;hpb=a75e07ccf58fe02fb6d0e452a46cc87f7d889fc7;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/api/ApiEmailUser.php b/includes/api/ApiEmailUser.php index 15eb475e73..192378e8e8 100644 --- a/includes/api/ApiEmailUser.php +++ b/includes/api/ApiEmailUser.php @@ -36,7 +36,7 @@ class ApiEmailUser extends ApiBase { // Validate target $targetUser = SpecialEmailUser::getTarget( $params['target'] ); if ( !( $targetUser instanceof User ) ) { - $this->dieUsageMsg( array( $targetUser ) ); + $this->dieUsageMsg( [ $targetUser ] ); } // Check permissions and errors @@ -46,15 +46,15 @@ class ApiEmailUser extends ApiBase { $this->getConfig() ); if ( $error ) { - $this->dieUsageMsg( array( $error ) ); + $this->dieUsageMsg( [ $error ] ); } - $data = array( + $data = [ 'Target' => $targetUser->getName(), 'Text' => $params['text'], 'Subject' => $params['subject'], 'CCMe' => $params['ccme'], - ); + ]; $retval = SpecialEmailUser::submit( $data, $this->getContext() ); if ( $retval instanceof Status ) { @@ -68,12 +68,12 @@ class ApiEmailUser extends ApiBase { } if ( $retval === true ) { - $result = array( 'result' => 'Success' ); + $result = [ 'result' => 'Success' ]; } else { - $result = array( + $result = [ 'result' => 'Failure', 'message' => $retval - ); + ]; } $this->getResult()->addValue( null, $this->getModuleName(), $result ); @@ -88,18 +88,18 @@ class ApiEmailUser extends ApiBase { } public function getAllowedParams() { - return array( - 'target' => array( + return [ + 'target' => [ ApiBase::PARAM_TYPE => 'string', ApiBase::PARAM_REQUIRED => true - ), + ], 'subject' => null, - 'text' => array( - ApiBase::PARAM_TYPE => 'string', + 'text' => [ + ApiBase::PARAM_TYPE => 'text', ApiBase::PARAM_REQUIRED => true - ), + ], 'ccme' => false, - ); + ]; } public function needsToken() { @@ -107,10 +107,10 @@ class ApiEmailUser extends ApiBase { } protected function getExamplesMessages() { - return array( + return [ 'action=emailuser&target=WikiSysop&text=Content&token=123ABC' => 'apihelp-emailuser-example-email', - ); + ]; } public function getHelpUrls() {