MaxReferencedEntityVisitsExhaustedException   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 7
c 1
b 0
f 0
dl 0
loc 35
rs 10
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getMaxEntityVisits() 0 2 1
A __construct() 0 13 2
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
 * @SuppressWarnings(PHPMD.LongClassName)
16
 */
17
class MaxReferencedEntityVisitsExhaustedException extends ReferencedEntityIdLookupException {
18
19
	/**
20
	 * @var int
21
	 */
22
	private $maxEntityVisits;
23
24
	/**
25
	 * @param EntityId $fromId
26
	 * @param PropertyId $propertyId
27
	 * @param EntityId[] $toIds
28
	 * @param int $maxEntityVisits
29
	 * @param string|null $message
30
	 * @param Exception|null $previous
31
	 */
32
	public function __construct(
33
		EntityId $fromId,
34
		PropertyId $propertyId,
35
		array $toIds,
36
		$maxEntityVisits,
37
		$message = null,
38
		?Exception $previous = null
39
	) {
40
		$this->maxEntityVisits = $maxEntityVisits;
41
		$message = $message ?: 'Referenced entity id lookup failed: Maximum number of entity visits (' .
42
				$maxEntityVisits . ') exhausted.';
43
44
		parent::__construct( $fromId, $propertyId, $toIds, $message, $previous );
45
	}
46
47
	/**
48
	 * @return int
49
	 */
50
	public function getMaxEntityVisits() {
51
		return $this->maxEntityVisits;
52
	}
53
54
}
55