EntityLookupException::__construct()   A
last analyzed

Complexity

Conditions 2
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 2

Importance

Changes 0
Metric Value
cc 2
eloc 4
c 0
b 0
f 0
nc 1
nop 3
dl 0
loc 7
ccs 5
cts 5
cp 1
crap 2
rs 10
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 EntityLookupException extends RuntimeException {
16
17
	/**
18
	 * @var EntityId
19
	 */
20
	private $entityId;
21
22
	/**
23
	 * @param EntityId $entityId
24
	 * @param string|null $message
25
	 * @param Exception|null $previous
26
	 */
27 1
	public function __construct( EntityId $entityId, $message = null, ?Exception $previous = null ) {
28 1
		$this->entityId = $entityId;
29
30 1
		parent::__construct(
31 1
			$message ?: 'Entity lookup failed for: ' . $entityId,
32 1
			0,
33
			$previous
34 1
		);
35 1
	}
36
37
	/**
38
	 * @return EntityId
39
	 */
40 1
	public function getEntityId() {
41 1
		return $this->entityId;
42
	}
43
44
}
45