|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare( strict_types = 1 ); |
|
4
|
|
|
|
|
5
|
|
|
namespace WikibaseQuality\ConstraintReport\Api; |
|
6
|
|
|
|
|
7
|
|
|
use Language; |
|
8
|
|
|
use Wikibase\Lib\Store\EntityTitleLookup; |
|
9
|
|
|
use Wikibase\Repo\EntityIdLabelFormatterFactory; |
|
10
|
|
|
use WikibaseQuality\ConstraintReport\ConstraintCheck\Message\ViolationMessageRendererFactory; |
|
11
|
|
|
|
|
12
|
|
|
/** |
|
13
|
|
|
* @license GPL-2.0-or-later |
|
14
|
|
|
*/ |
|
15
|
|
|
class CheckResultsRendererFactory { |
|
16
|
|
|
|
|
17
|
|
|
/** @var EntityTitleLookup */ |
|
18
|
|
|
private $entityTitleLookup; |
|
19
|
|
|
|
|
20
|
|
|
/** @var EntityIdLabelFormatterFactory */ |
|
21
|
|
|
private $entityIdLabelFormatterFactory; |
|
22
|
|
|
|
|
23
|
|
|
/** @var ViolationMessageRendererFactory */ |
|
24
|
|
|
private $violationMessageRendererFactory; |
|
25
|
|
|
|
|
26
|
|
|
public function __construct( |
|
27
|
|
|
EntityTitleLookup $entityTitleLookup, |
|
28
|
|
|
EntityIdLabelFormatterFactory $entityIdLabelFormatterFactory, |
|
29
|
|
|
ViolationMessageRendererFactory $violationMessageRendererFactory |
|
30
|
|
|
) { |
|
31
|
|
|
$this->entityTitleLookup = $entityTitleLookup; |
|
32
|
|
|
$this->entityIdLabelFormatterFactory = $entityIdLabelFormatterFactory; |
|
33
|
|
|
$this->violationMessageRendererFactory = $violationMessageRendererFactory; |
|
34
|
|
|
} |
|
35
|
|
|
|
|
36
|
|
|
public function getCheckResultsRenderer( Language $language ): CheckResultsRenderer { |
|
37
|
|
|
return new CheckResultsRenderer( |
|
38
|
|
|
$this->entityTitleLookup, |
|
39
|
|
|
$this->entityIdLabelFormatterFactory |
|
40
|
|
|
->getEntityIdFormatter( $language ), |
|
41
|
|
|
$this->violationMessageRendererFactory |
|
42
|
|
|
->getViolationMessageRenderer( $language ) |
|
43
|
|
|
); |
|
44
|
|
|
} |
|
45
|
|
|
|
|
46
|
|
|
} |
|
47
|
|
|
|