Completed
Push — master ( 368b39...82a3c0 )
by
unknown
11:54
created

UnitsParameter::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 9
rs 9.6666
c 0
b 0
f 0
cc 1
eloc 7
nc 1
nop 3
1
<?php
2
3
namespace WikibaseQuality\ConstraintReport\ConstraintCheck\Helper;
4
5
use DataValues\UnboundedQuantityValue;
6
use Wikibase\DataModel\Entity\ItemId;
7
8
/**
9
 * Wrapper class for a constraint parameter representing a list of units.
10
 *
11
 * @license GPL-2.0-or-later
12
 * @author Lucas Werkmeister
13
 */
14
class UnitsParameter {
15
16
	/**
17
	 * @var ItemId[]
18
	 */
19
	private $unitItemIds;
20
21
	/**
22
	 * @var UnboundedQuantityValue[]
23
	 */
24
	private $unitQuantities;
25
26
	/**
27
	 * @var bool
28
	 */
29
	private $unitlessAllowed;
30
31
	/**
32
	 * @param ItemId[] $unitItemIds The item IDs of the allowed units.
33
	 * @param UnboundedQuantityValue[] $unitQuantities Quantities with the allowed units.
34
	 * @param bool $unitlessAllowed Whether unitless values (unit '1') are allowed or not.
35
	 */
36
	public function __construct(
37
		array $unitItemIds,
38
		array $unitQuantities,
39
		$unitlessAllowed
40
	) {
41
		$this->unitItemIds = $unitItemIds;
42
		$this->unitQuantities = $unitQuantities;
43
		$this->unitlessAllowed = $unitlessAllowed;
44
	}
45
46
	/**
47
	 * @return ItemId[] The item IDs of the allowed units.
48
	 */
49
	public function getUnitItemIds() {
50
		return $this->unitItemIds;
51
	}
52
53
	/**
54
	 * @return UnboundedQuantityValue[] Quantities with the allowed units.
55
	 */
56
	public function getUnitQuantities() {
57
		return $this->unitQuantities;
58
	}
59
60
	/**
61
	 * @return bool Whether unitless values (unit '1') are allowed or not.
62
	 */
63
	public function getUnitlessAllowed() {
64
		return $this->unitlessAllowed;
65
	}
66
67
}
68