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

getMaxEntityVisits()   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 MaxReferencedEntityVisitsExhaustedException extends ReferencedEntityIdLookupException {
16
17
	/**
18
	 * @var int
19
	 */
20
	private $maxEntityVisits;
21
22
	/**
23
	 * @param EntityId $fromId
24
	 * @param PropertyId $propertyId
25
	 * @param EntityId[] $toIds
26
	 * @param int $maxEntityVisits
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
		$maxEntityVisits,
35
		$message = null,
36
		Exception $previous = null
37
	) {
38
		$this->maxEntityVisits = $maxEntityVisits;
39
		$message = $message ?: 'Referenced entity id lookup failed: Maximum number of entity visits (' .
40
				$maxEntityVisits . ') exhausted.';
41
42
		parent::__construct( $fromId, $propertyId, $toIds, $message, $previous );
43
	}
44
45
	/**
46
	 * @return int
47
	 */
48
	public function getMaxEntityVisits() {
49
		return $this->maxEntityVisits;
50
	}
51
52
}
53