mediawiki-extensions-AbuseF.../includes/EditBoxBuilderFactory.php
Matěj Suchánek 1ad77dc9fb Introduce EditBoxBuilderFactory service and EditBoxBuilder
It makes sense to look at this and Iedd7a5dca24 together,
as this patch itself doesn't really fix anything.

Change-Id: Ifef5266b1803d1a96489789b08d9beed044d908f
2020-11-26 14:49:04 +01:00

62 lines
1.2 KiB
PHP

<?php
namespace MediaWiki\Extension\AbuseFilter;
use MessageLocalizer;
use OutputPage;
use User;
/**
* Factory for EditBoxBuilder objects
*/
class EditBoxBuilderFactory {
public const SERVICE_NAME = 'AbuseFilterEditBoxBuilderFactory';
/** @var AbuseFilterPermissionManager */
private $afPermManager;
/** @var KeywordsManager */
private $keywordsManager;
/** @var bool */
private $isCodeEditorLoaded;
/**
* @param AbuseFilterPermissionManager $afPermManager
* @param KeywordsManager $keywordsManager
* @param bool $isCodeEditorLoaded
*/
public function __construct(
AbuseFilterPermissionManager $afPermManager,
KeywordsManager $keywordsManager,
bool $isCodeEditorLoaded
) {
$this->afPermManager = $afPermManager;
$this->keywordsManager = $keywordsManager;
$this->isCodeEditorLoaded = $isCodeEditorLoaded;
}
/**
* @param MessageLocalizer $messageLocalizer
* @param User $user
* @param OutputPage $output
* @return EditBoxBuilder
*/
public function newEditBoxBuilder(
MessageLocalizer $messageLocalizer,
User $user,
OutputPage $output
) : EditBoxBuilder {
return new EditBoxBuilder(
$this->afPermManager,
$this->keywordsManager,
$this->isCodeEditorLoaded,
$messageLocalizer,
$user,
$output
);
}
}