Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 6 |
|
0.00% |
0 / 4 |
CRAP | |
0.00% |
0 / 1 |
UnitsParameter | |
0.00% |
0 / 6 |
|
0.00% |
0 / 4 |
20 | |
0.00% |
0 / 1 |
__construct | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
2 | |||
getUnitItemIds | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getUnitQuantities | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getUnitlessAllowed | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 |
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 | } |