Completed
Push — master ( a718f1...259f04 )
by
unknown
01:49
created

CheckResultsRendererFactory::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 9
rs 9.9666
c 0
b 0
f 0
cc 1
nc 1
nop 3
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