EntityRedirectLookupException::__construct()   A
last analyzed

Complexity

Conditions 2
Paths 1

Size

Total Lines 9

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
dl 0
loc 9
ccs 0
cts 8
cp 0
rs 9.9666
c 0
b 0
f 0
cc 2
nc 1
nop 3
crap 6
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 EntityRedirectLookupException 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
	public function __construct( EntityId $entityId, $message = null, Exception $previous = null ) {
28
		$this->entityId = $entityId;
29
30
		parent::__construct(
31
			$message ?: 'Entity redirect lookup failed for: ' . $entityId,
32
			0,
33
			$previous
34
		);
35
	}
36
37
	/**
38
	 * @return EntityId
39
	 */
40
	public function getEntityId() {
41
		return $this->entityId;
42
	}
43
44
}
45