ItemType::getItemId()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
cc 2
nc 2
nop 0
dl 0
loc 6
ccs 0
cts 4
cp 0
crap 6
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Queryr\Resources;
4
5
use RuntimeException;
6
use Wikibase\DataModel\Entity\ItemId;
7
8
/**
9
 * @licence GNU GPL v2+
10
 * @author Jeroen De Dauw < [email protected] >
11
 */
12
class ItemType {
13
14
	private $label;
15
	private $itemId;
16
	private $apiUrl;
17
	private $wikidataUrl;
18
19
	/**
20
	 * @param string $apiUrl
21
	 */
22
	public function setApiUrl( $apiUrl ) {
23
		$this->apiUrl = $apiUrl;
24
	}
25
26
	/**
27
	 * @param ItemId $itemId
28
	 */
29
	public function setItemId( ItemId $itemId ) {
30
		$this->itemId = $itemId;
31
	}
32
33
	/**
34
	 * @param string $label
35
	 */
36
	public function setLabel( $label ) {
37
		$this->label = $label;
38
	}
39
40
	/**
41
	 * @param string $wikidataUrl
42
	 */
43
	public function setWikidataUrl( $wikidataUrl ) {
44
		$this->wikidataUrl = $wikidataUrl;
45
	}
46
47
	/**
48
	 * @return string
49
	 * @throws RuntimeException
50
	 */
51
	public function getApiUrl() {
52
		if ( $this->apiUrl === null ) {
53
			throw new RuntimeException( 'Field not set' );
54
		}
55
		return $this->apiUrl;
56
	}
57
58
	/**
59
	 * @return ItemId
60
	 * @throws RuntimeException
61
	 */
62
	public function getItemId() {
63
		if ( $this->itemId === null ) {
64
			throw new RuntimeException( 'Field not set' );
65
		}
66
		return $this->itemId;
67
	}
68
69
	/**
70
	 * @return string
71
	 * @throws RuntimeException
72
	 */
73
	public function getLabel() {
74
		if ( $this->label === null ) {
75
			throw new RuntimeException( 'Field not set' );
76
		}
77
		return $this->label;
78
	}
79
80
	/**
81
	 * @return string
82
	 * @throws RuntimeException
83
	 */
84
	public function getWikidataUrl() {
85
		if ( $this->wikidataUrl === null ) {
86
			throw new RuntimeException( 'Field not set' );
87
		}
88
		return $this->wikidataUrl;
89
	}
90
91
}
92