| 1 |
<?php |
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
namespace MediaWiki\Preferences; |
| 23 |
|
| 24 |
use MediaWiki\Config\ServiceOptions; |
| 25 |
use MediaWiki\Parser\ParserOptions; |
| 26 |
use MediaWiki\SpecialPage\SpecialPageFactory; |
| 27 |
use MediaWiki\Title\TitleFactory; |
| 28 |
use MediaWiki\User\UserIdentity; |
| 29 |
use MessageLocalizer; |
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
class SignatureValidatorFactory { |
| 35 |
|
| 36 |
private $serviceOptions; |
| 37 |
|
| 38 |
|
| 39 |
private $parserFactoryClosure; |
| 40 |
|
| 41 |
|
| 42 |
private $lintErrorCheckerClosure; |
| 43 |
|
| 44 |
|
| 45 |
private $specialPageFactory; |
| 46 |
|
| 47 |
|
| 48 |
private $titleFactory; |
| 49 |
|
| 50 |
|
| 51 |
|
| 52 |
|
| 53 |
|
| 54 |
|
| 55 |
|
| 56 |
|
| 57 |
|
| 58 |
|
| 59 |
public function __construct( |
| 60 |
ServiceOptions $options, |
| 61 |
callable $parserFactoryClosure, |
| 62 |
callable $lintErrorCheckerClosure, |
| 63 |
SpecialPageFactory $specialPageFactory, |
| 64 |
TitleFactory $titleFactory |
| 65 |
) { |
| 66 |
|
| 67 |
$this->serviceOptions = $options; |
| 68 |
$this->serviceOptions->assertRequiredOptions( SignatureValidator::CONSTRUCTOR_OPTIONS ); |
| 69 |
$this->parserFactoryClosure = $parserFactoryClosure; |
| 70 |
$this->lintErrorCheckerClosure = $lintErrorCheckerClosure; |
| 71 |
$this->specialPageFactory = $specialPageFactory; |
| 72 |
$this->titleFactory = $titleFactory; |
| 73 |
} |
| 74 |
|
| 75 |
|
| 76 |
|
| 77 |
|
| 78 |
|
| 79 |
|
| 80 |
|
| 81 |
public function newSignatureValidator( |
| 82 |
UserIdentity $user, |
| 83 |
?MessageLocalizer $localizer, |
| 84 |
ParserOptions $popts |
| 85 |
): SignatureValidator { |
| 86 |
return new SignatureValidator( |
| 87 |
$this->serviceOptions, |
| 88 |
$user, |
| 89 |
$localizer, |
| 90 |
$popts, |
| 91 |
( $this->parserFactoryClosure )(), |
| 92 |
( $this->lintErrorCheckerClosure )(), |
| 93 |
$this->specialPageFactory, |
| 94 |
$this->titleFactory, |
| 95 |
); |
| 96 |
} |
| 97 |
} |