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

CheckResultsRendererFactory   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 2
dl 0
loc 32
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 9 1
A getCheckResultsRenderer() 0 9 1
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