Test Failed
Push — master ( 4486b3...16bdc1 )
by SignpostMarv
02:20
created

PriceSpecification::SetEligibleTransactionVolume()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 1
dl 0
loc 5
ccs 3
cts 3
cp 1
crap 1
rs 10
c 0
b 0
f 0
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\DataTypes\DateTime;
11
use SignpostMarv\DaftObject\SchemaOrg\Intangible\StructuredValue as Base;
12
use SignpostMarv\DaftObject\SchemaOrg\TypeUtilities;
13
14
/**
15
* @property array<int, QuantitativeValue> $eligibleQuantity
16
* @property array<int, PriceSpecification> $eligibleTransactionVolume
17
* @property array<int, int> $maxPrice
18
* @property array<int, int> $minPrice
19
* @property array<int, int|string> $price
20
* @property array<int, string> $priceCurrency
21
* @property array<int, bool> $valueAddedTaxIncluded
22
* @property array<int, DateTime> $validFrom
23
* @property array<int, DateTime> $validThrough
24
*/
25
class PriceSpecification extends Base
26
{
27
    use DaftObjectTraits\PricePriceCurrency;
28
    use DaftObjectTraits\HasValidFromThrough;
29
30
    const SCHEMA_ORG_TYPE = 'PriceSpecification';
31
32
    const PROPERTIES = [
33
        'eligibleQuantity',
34
        'eligibleTransactionVolume',
35
        'maxPrice',
36
        'minPrice',
37
        'price',
38
        'priceCurrency',
39
        'validFrom',
40
        'validThrough',
41
        'valueAddedTaxIncluded',
42
    ];
43
44
    const PROPERTIES_WITH_MULTI_TYPED_ARRAYS = [
45
        'eligibleQuantity' => [
46
            QuantitativeValue::class,
47
        ],
48
        'eligibleTransactionVolume' => [
49
            PriceSpecification::class,
50
        ],
51
        'maxPrice' => [
52
            'integer',
53
        ],
54
        'minPrice' => [
55
            'integer',
56
        ],
57
        'price' => [
58
            'integer',
59
            'string',
60
        ],
61
        'priceCurrency' => [
62
            'string',
63
        ],
64
        'valueAddedTaxIncluded' => [
65
            'boolean',
66
        ],
67
        'validFrom' => [
68
            DateTime::class,
69
        ],
70
        'validThrough' => [
71
            DateTime::class,
72
        ],
73
    ];
74
75
    /**
76
    * @return array<int, QuantitativeValue>
77 16
    */
78
    public function GetEligibleQuantity() : array
79
    {
80
        /**
81
        * @var array<int, QuantitativeValue>
82 16
        */
83 16
        $out = TypeUtilities::ExpectRetrievedValueIsArray(
84 16
            'eligibleQuantity',
85 16
            $this->RetrievePropertyValueFromData('eligibleQuantity'),
86
            static::class
87
        );
88 16
89
        return $out;
90
    }
91
92
    /**
93
    * @param array<int, PriceSpecification> $value
94 1
    */
95
    public function SetEligibleQuantity(array $value) : void
96 1
    {
97 1
        $this->NudgePropertyValue(
98 1
            'eligibleQuantity',
99
            $value
100 1
        );
101
    }
102
103
    /**
104
    * @return array<int, PriceSpecification>
105 16
    */
106
    public function GetEligibleTransactionVolume() : array
107
    {
108
        /**
109
        * @var array<int, PriceSpecification>
110 16
        */
111 16
        $out = TypeUtilities::ExpectRetrievedValueIsArray(
112 16
            'eligibleTransactionVolume',
113 16
            $this->RetrievePropertyValueFromData('eligibleTransactionVolume'),
114
            static::class
115
        );
116 16
117
        return $out;
118
    }
119
120
    /**
121
    * @param array<int, PriceSpecification> $value
122 1
    */
123
    public function SetEligibleTransactionVolume(array $value) : void
124 1
    {
125 1
        $this->NudgePropertyValue(
126 1
            'eligibleTransactionVolume',
127
            $value
128 1
        );
129
    }
130
131
    /**
132
    * @return array<int, int>
133 16
    */
134
    public function GetMaxPrice() : array
135
    {
136
        /**
137
        * @var array<int, int>
138 16
        */
139 16
        $out = TypeUtilities::ExpectRetrievedValueIsArray(
140 16
            'maxPrice',
141 16
            $this->RetrievePropertyValueFromData('maxPrice'),
142
            static::class
143
        );
144 16
145
        return $out;
146
    }
147
148
    /**
149
    * @param array<int, int> $value
150 1
    */
151
    public function SetMaxPrice(array $value) : void
152 1
    {
153 1
        $this->NudgePropertyValue('maxPrice', $value);
154
    }
155
156
    /**
157
    * @return array<int, int>
158 16
    */
159
    public function GetMinPrice() : array
160
    {
161
        /**
162
        * @var array<int, int>
163 16
        */
164 16
        $out = TypeUtilities::ExpectRetrievedValueIsArray(
165 16
            'minPrice',
166 16
            $this->RetrievePropertyValueFromData('minPrice'),
167
            static::class
168
        );
169 16
170
        return $out;
171
    }
172
173
    /**
174
    * @param array<int, int> $value
175 1
    */
176
    public function SetMinPrice(array $value) : void
177 1
    {
178 1
        $this->NudgePropertyValue('minPrice', $value);
179
    }
180
181
    /**
182
    * @return array<int, bool>
183 16
    */
184
    public function GetValueAddedTaxIncluded() : array
185
    {
186
        /**
187
        * @var array<int, bool>
188 16
        */
189 16
        $out = TypeUtilities::ExpectRetrievedValueIsArray(
190 16
            'valueAddedTaxIncluded',
191 16
            $this->RetrievePropertyValueFromData('valueAddedTaxIncluded'),
192
            static::class
193
        );
194 16
195
        return $out;
196
    }
197
198
    /**
199
    * @param array<int, bool> $value
200 1
    */
201
    public function SetValueAddedTaxIncluded(array $value) : void
202 1
    {
203 1
        $this->NudgePropertyWithUniqueBooleans(
204 1
            'valueAddedTaxIncluded',
205
            $value
206 1
        );
207
    }
208
}
209