Completed
Push — master ( f77362...00c6d5 )
by
unknown
06:40
created

EntityContextCursor::getStatementPropertyId()   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 WikibaseQuality\ConstraintReport\ConstraintCheck\Context;
4
5
use LogicException;
6
7
/**
8
 * A context cursor that is only associated with an entity,
9
 * not with any statement or something else within it.
10
 * It can only be used to partially populate a results container,
11
 * not to actually store a full check result.
12
 *
13
 * @author Lucas Werkmeister
14
 * @license GPL-2.0-or-later
15
 */
16
class EntityContextCursor extends ApiV2ContextCursor {
17
18
	/**
19
	 * @var string
20
	 */
21
	private $entityId;
22
23
	/**
24
	 * @param string $entityId
25
	 */
26
	public function __construct(
27
		$entityId
28
	) {
29
		$this->entityId = $entityId;
30
	}
31
32
	/**
33
	 * @codeCoverageIgnore This method is not supported.
34
	 */
35
	public function getType() {
36
		throw new LogicException( 'EntityContextCursor has no full associated context' );
37
	}
38
39
	public function getEntityId() {
40
		return $this->entityId;
41
	}
42
43
	/**
44
	 * @codeCoverageIgnore This method is not supported.
45
	 */
46
	public function getStatementPropertyId() {
47
		throw new LogicException( 'EntityContextCursor has no full associated context' );
48
	}
49
50
	/**
51
	 * @codeCoverageIgnore This method is not supported.
52
	 */
53
	public function getStatementGuid() {
54
		throw new LogicException( 'EntityContextCursor has no full associated context' );
55
	}
56
57
	/**
58
	 * @codeCoverageIgnore This method is not supported.
59
	 */
60
	public function getSnakPropertyId() {
61
		throw new LogicException( 'EntityContextCursor has no full associated context' );
62
	}
63
64
	/**
65
	 * @codeCoverageIgnore This method is not supported.
66
	 */
67
	public function getSnakHash() {
68
		throw new LogicException( 'EntityContextCursor has no full associated context' );
69
	}
70
71
	/**
72
	 * @codeCoverageIgnore This method is not supported.
73
	 */
74
	public function &getMainArray( array &$container ) {
75
		throw new LogicException( 'EntityContextCursor cannot store check results' );
76
	}
77
78
	/**
79
	 * Populate the result container up to the 'claims' level.
80
	 *
81
	 * @param array|null $result must be null
82
	 * @param array[] &$container
83
	 */
84
	public function storeCheckResultInArray( array $result = null, array &$container ) {
85
		if ( $result !== null ) {
86
			throw new LogicException( 'EntityContextCursor cannot store check results' );
87
		}
88
89
		$this->getClaimsArray( $container );
90
	}
91
92
}
93