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

MaxReferenceDepthExhaustedException::getMaxDepth()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
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