Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
8 / 8
100.00% covered (success)
100.00%
5 / 5
CRAP
100.00% covered (success)
100.00%
1 / 1
Constraint
100.00% covered (success)
100.00%
8 / 8
100.00% covered (success)
100.00%
5 / 5
5
100.00% covered (success)
100.00%
1 / 1
 __construct
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
1 / 1
1
 getConstraintId
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getConstraintTypeItemId
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getPropertyId
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getConstraintParameters
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3namespace WikibaseQuality\ConstraintReport;
4
5use Wikibase\DataModel\Entity\NumericPropertyId;
6
7/**
8 * Contains all data belonging to a certain constraint.
9 *
10 * @license GPL-2.0-or-later
11 */
12class Constraint {
13
14    /**
15     * @var string
16     */
17    private $constraintId;
18
19    /**
20     * @var NumericPropertyId
21     */
22    private $propertyId;
23
24    /**
25     * @var string
26     */
27    private $constraintTypeItemId;
28
29    /**
30     * @var array
31     */
32    private $constraintParameters;
33
34    /**
35     * @param string $constraintId
36     * @param NumericPropertyId $propertyId
37     * @param string $constraintTypeItemId
38     * @param array $constraintParameters
39     */
40    public function __construct(
41        $constraintId,
42        NumericPropertyId $propertyId,
43        $constraintTypeItemId,
44        array $constraintParameters
45    ) {
46        $this->constraintId = $constraintId;
47        $this->propertyId = $propertyId;
48        $this->constraintTypeItemId = $constraintTypeItemId;
49        $this->constraintParameters = $constraintParameters;
50    }
51
52    /**
53     * @return string
54     */
55    public function getConstraintId() {
56        return $this->constraintId;
57    }
58
59    /**
60     * @return string
61     *
62     * Item ID serialization of the constraint type item.
63     */
64    public function getConstraintTypeItemId() {
65        return $this->constraintTypeItemId;
66    }
67
68    /**
69     * @return NumericPropertyId
70     */
71    public function getPropertyId() {
72        return $this->propertyId;
73    }
74
75    /**
76     * The constraint parameters, imported from the qualifiers of the constraint statement.
77     * Contains lists of snak array serializations, indexed by property ID serialization.
78     * (The import is done by {@link UpdateConstraintsTableJob}.)
79     *
80     * @return array
81     */
82    public function getConstraintParameters() {
83        return $this->constraintParameters;
84    }
85
86}