// Validate target
$targetUser = SpecialEmailUser::getTarget( $params['target'] );
if ( !( $targetUser instanceof User ) ) {
- $this->dieUsageMsg( array( $targetUser ) );
+ $this->dieUsageMsg( [ $targetUser ] );
}
// Check permissions and errors
$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 ) {
}
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 );
}
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() {
return 'csrf';
}
- public function getExamplesMessages() {
- return array(
+ protected function getExamplesMessages() {
+ return [
'action=emailuser&target=WikiSysop&text=Content&token=123ABC'
=> 'apihelp-emailuser-example-email',
- );
+ ];
}
public function getHelpUrls() {