TermLookupException   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 3
c 0
b 0
f 0
lcom 0
cbo 0
dl 0
loc 38
ccs 0
cts 10
cp 0
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 16 2
A getEntityId() 0 3 1
1
<?php
2
3
namespace Wikibase\DataModel\Services\Lookup;
4
5
use Exception;
6
use RuntimeException;
7
use Wikibase\DataModel\Entity\EntityId;
8
9
/**
10
 * @since 2.0
11
 *
12
 * @license GPL-2.0-or-later
13
 * @author Addshore
14
 */
15
class TermLookupException extends RuntimeException {
16
17
	/**
18
	 * @var EntityId
19
	 */
20
	private $entityId;
21
22
	/**
23
	 * @param EntityId $entityId
24
	 * @param string[] $languageCodes
25
	 * @param string|null $message
26
	 * @param Exception|null $previous
27
	 */
28
	public function __construct(
29
		EntityId $entityId,
30
		array $languageCodes,
31
		$message = null,
32
		Exception $previous = null
33
	) {
34
		$this->entityId = $entityId;
35
36
		$codesString = implode( ', ', $languageCodes );
37
38
		parent::__construct(
39
			$message ?: 'Term lookup failed for: ' . $entityId . ' with language codes: ' . $codesString,
40
			0,
41
			$previous
42
		);
43
	}
44
45
	/**
46
	 * @return EntityId
47
	 */
48
	public function getEntityId() {
49
		return $this->entityId;
50
	}
51
52
}
53