Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 13
0.00% covered (danger)
0.00%
0 / 3
CRAP
0.00% covered (danger)
0.00%
0 / 1
TranslateSandboxEmailJob
0.00% covered (danger)
0.00%
0 / 13
0.00% covered (danger)
0.00%
0 / 3
12
0.00% covered (danger)
0.00%
0 / 1
 newJob
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 __construct
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 run
0.00% covered (danger)
0.00%
0 / 11
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2declare( strict_types = 1 );
3
4namespace MediaWiki\Extension\Translate\TranslatorSandbox;
5
6use Job;
7use MediaWiki\MediaWikiServices;
8use MediaWiki\Title\Title;
9
10class TranslateSandboxEmailJob extends Job {
11
12    public static function newJob( array $params ): self {
13        return new self( Title::newMainPage(), $params );
14    }
15
16    public function __construct( Title $title, array $params ) {
17        parent::__construct( 'TranslateSandboxEmailJob', $title, $params );
18    }
19
20    public function run(): bool {
21        $status = MediaWikiServices::getInstance()
22            ->getEmailer()
23            ->send(
24                [ $this->params['to'] ],
25                $this->params['from'],
26                $this->params['subj'],
27                $this->params['body'],
28                null,
29                [ 'replyTo' => $this->params['replyto'] ]
30            );
31
32        return $status->isOK();
33    }
34}