Completed
Push — master ( 379b27...5b49bb )
by
unknown
12s
created

MaxReferenceDepthExhaustedException   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 1
dl 0
loc 37
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 13 2
A getMaxDepth() 0 3 1
1
<?php
2
3
namespace Wikibase\DataModel\Services\Lookup;
4
5
use Exception;
6
use Wikibase\DataModel\Entity\EntityId;
7
use Wikibase\DataModel\Entity\PropertyId;
8
9
/**
10
 * @since 3.10
11
 *
12
 * @license GPL-2.0-or-later
13
 * @author Marius Hoch
14
 */
15
class MaxReferenceDepthExhaustedException extends ReferencedEntityIdLookupException {
16
17
	/**
18
	 * @var int
19
	 */
20
	private $maxDepth;
21
22
	/**
23
	 * @param EntityId $fromId
24
	 * @param PropertyId $propertyId
25
	 * @param EntityId[] $toIds
26
	 * @param int $maxDepth
27
	 * @param string|null $message
28
	 * @param Exception|null $previous
29
	 */
30
	public function __construct(
31
		EntityId $fromId,
32
		PropertyId $propertyId,
33
		array $toIds,
34
		$maxDepth,
35
		$message = null,
36
		Exception $previous = null
37
	) {
38
		$this->maxDepth = $maxDepth;
39
		$message = $message ?: 'Referenced entity id lookup failed: Maximum depth of ' . $maxDepth . ' exhausted.';
40
41
		parent::__construct( $fromId, $propertyId, $toIds, $message, $previous );
42
	}
43
44
	/**
45
	 * @return int
46
	 */
47
	public function getMaxDepth() {
48
		return $this->maxDepth;
49
	}
50
51
}
52