Passed
Push — master ( 461a97...e7ae09 )
by SignpostMarv
02:31
created

PropertyValue   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 76
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
eloc 45
dl 0
loc 76
ccs 0
cts 15
cp 0
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A SetPropertyID() 0 6 1
A GetPropertyID() 0 12 1
1
<?php
2
/**
3
* @author SignpostMarv
4
*/
5
declare(strict_types=1);
6
7
namespace SignpostMarv\DaftObject\SchemaOrg\Intangible\StructuredValue;
8
9
use SignpostMarv\DaftObject\SchemaOrg\DaftObjectTraits;
10
use SignpostMarv\DaftObject\SchemaOrg\Intangible\Enumeration;
11
use SignpostMarv\DaftObject\SchemaOrg\Intangible\Enumeration\QualitativeValue;
12
use SignpostMarv\DaftObject\SchemaOrg\Intangible\StructuredValue as Base;
13
use SignpostMarv\DaftObject\SchemaOrg\TypeUtilities;
14
15
/**
16
* @property array<int, int|float> $maxValue
17
* @property array<int, string> $measurementTechnique
18
* @property array<int, int|float> $minValue
19
* @property array<int, string> $propertyID
20
* @property array<int, string> $unitCode
21
* @property array<int, string> $unitText
22
* @property array<int, bool|int|float|string|PropertyValue> $value
23
* @property array<int, QualitativeValue|Enumeration|PropertyValue|QuantitativeValue|Base> $valueReference
24
*/
25
class PropertyValue extends Base
26
{
27
    use DaftObjectTraits\MeasurementTechnique;
28
    use DaftObjectTraits\TraitMinMaxValueUnit;
29
    use DaftObjectTraits\TraitValueReference;
30
31
    const SCHEMA_ORG_TYPE = 'PropertyValue';
32
33
    const PROPERTIES = [
34
        'maxValue',
35
        'measurementTechnique',
36
        'minValue',
37
        'propertyID',
38
        'unitCode',
39
        'unitText',
40
        'value',
41
        'valueReference',
42
    ];
43
44
    const PROPERTIES_WITH_MULTI_TYPED_ARRAYS = [
45
        'maxValue' => [
46
            'integer',
47
            'double',
48
        ],
49
        'measurementTechnique' => [
50
            'string',
51
        ],
52
        'minValue' => [
53
            'integer',
54
            'double',
55
        ],
56
        'propertyID' => [
57
            'string',
58
        ],
59
        'unitCode' => [
60
            'string',
61
        ],
62
        'unitText' => [
63
            'string',
64
        ],
65
        'value' => [
66
            'boolean',
67
            'integer',
68
            'double',
69
            'string',
70
            Base::class,
71
        ],
72
        'valueReference' => TypeUtilities::MULTI_TYPE_DICT__valueReference,
73
    ];
74
75
    /**
76
    * @return array<int, string>
77
    */
78
    public function GetPropertyID() : array
79
    {
80
        /**
81
        * @var array<int, string>
82
        */
83
        $out = TypeUtilities::ExpectRetrievedValueIsArray(
84
            'propertyID',
85
            $this->RetrievePropertyValueFromData('propertyID'),
86
            static::class
87
        );
88
89
        return $out;
90
    }
91
92
    /**
93
    * @param array<int, string> $value
94
    */
95
    public function SetPropertyID(array $value) : void
96
    {
97
        $this->NudgePropertyValue(
98
            'propertyID',
99
            $value,
100
            true
101
        );
102
    }
103
}
104