PropertyValue   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 74
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
eloc 44
dl 0
loc 74
ccs 11
cts 11
cp 1
rs 10
c 0
b 0
f 0

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