Test Failed
Push — master ( d87250...ffa34c )
by SignpostMarv
12:19
created

PriceSpecification::SetEligibleQuantity()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 1
dl 0
loc 5
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\Intangible\StructuredValue\QuantitativeValue;
13
use SignpostMarv\DaftObject\SchemaOrg\TypeUtilities;
14
15
/**
16
* @property array<int, QuantitativeValue> $eligibleQuantity
17
* @property array<int, PriceSpecification> $eligibleTransactionVolume
18
* @property array<int, int> $maxPrice
19
* @property array<int, int> $minPrice
20
* @property array<int, int|string> $price
21
* @property array<int, string> $priceCurrency
22
* @property array<int, bool> $valueAddedTaxIncluded
23
* @property array<int, DateTime> $validFrom
24
* @property array<int, DateTime> $validThrough
25
*/
26
class PriceSpecification extends Base
27
{
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
    */
78
    public function GetEligibleQuantity() : array
79
    {
80
        /**
81
        * @var array<int, QuantitativeValue>
82
        */
83
        $out = TypeUtilities::ExpectRetrievedValueIsArray(
84
            'eligibleQuantity',
85
            $this->RetrievePropertyValueFromData('eligibleQuantity'),
86
            static::class
87
        );
88
89
        return $out;
90
    }
91
92
    /**
93
    * @param array<int, PriceSpecification> $value
94
    */
95
    public function SetEligibleQuantity(array $value) : void
96
    {
97
        $this->NudgePropertyValue(
98
            'eligibleQuantity',
99
            $value
100
        );
101
    }
102
103
    /**
104
    * @return array<int, PriceSpecification>
105
    */
106
    public function GetEligibleTransactionVolume() : array
107
    {
108
        /**
109
        * @var array<int, PriceSpecification>
110
        */
111
        $out = TypeUtilities::ExpectRetrievedValueIsArray(
112
            'eligibleTransactionVolume',
113
            $this->RetrievePropertyValueFromData('eligibleTransactionVolume'),
114
            static::class
115
        );
116
117
        return $out;
118
    }
119
120
    /**
121
    * @param array<int, PriceSpecification> $value
122
    */
123
    public function SetEligibleTransactionVolume(array $value) : void
124
    {
125
        $this->NudgePropertyValue(
126
            'eligibleTransactionVolume',
127
            $value
128
        );
129
    }
130
131
    /**
132
    * @return array<int, int>
133
    */
134
    public function GetMaxPrice() : array
135
    {
136
        /**
137
        * @var array<int, int>
138
        */
139
        $out = TypeUtilities::ExpectRetrievedValueIsArray(
140
            'maxPrice',
141
            $this->RetrievePropertyValueFromData('maxPrice'),
142
            static::class
143
        );
144
145
        return $out;
146
    }
147
148
    /**
149
    * @param array<int, int> $value
150
    */
151
    public function SetMaxPrice(array $value) : void
152
    {
153
        $this->NudgePropertyValue('maxPrice', $value);
154
    }
155
156
    /**
157
    * @return array<int, int>
158
    */
159
    public function GetMinPrice() : array
160
    {
161
        /**
162
        * @var array<int, int>
163
        */
164
        $out = TypeUtilities::ExpectRetrievedValueIsArray(
165
            'minPrice',
166
            $this->RetrievePropertyValueFromData('minPrice'),
167
            static::class
168
        );
169
170
        return $out;
171
    }
172
173
    /**
174
    * @param array<int, int> $value
175
    */
176
    public function SetMinPrice(array $value) : void
177
    {
178
        $this->NudgePropertyValue('minPrice', $value);
179
    }
180
181
    /**
182
    * @return array<int, int|string>
183
    */
184
    public function GetPrice() : array
185
    {
186
        /**
187
        * @var array<int, int|string>
188
        */
189
        $out = TypeUtilities::ExpectRetrievedValueIsArray(
190
            'price',
191
            $this->RetrievePropertyValueFromData('price'),
192
            static::class
193
        );
194
195
        return $out;
196
    }
197
198
    /**
199
    * @param array<int, int|string> $value
200
    */
201
    public function SetPrice(array $value) : void
202
    {
203
        $this->NudgePropertyValue(
204
            'price',
205
            $value
206
        );
207
    }
208
209
    /**
210
    * @return array<int, string>
211
    */
212
    public function GetPriceCurrency() : array
213
    {
214
        /**
215
        * @var array<int, string>
216
        */
217
        $out = TypeUtilities::ExpectRetrievedValueIsArray(
218
            'priceCurrency',
219
            $this->RetrievePropertyValueFromData('priceCurrency'),
220
            static::class
221
        );
222
223
        return $out;
224
    }
225
226
    /**
227
    * @param array<int, string> $value
228
    */
229
    public function SetPriceCurrency(array $value) : void
230
    {
231
        $this->NudgePropertyValue(
232
            'priceCurrency',
233
            $value
234
        );
235
    }
236
237
    /**
238
    * @return array<int, bool>
239
    */
240
    public function GetValueAddedTaxIncluded() : array
241
    {
242
        /**
243
        * @var array<int, bool>
244
        */
245
        $out = TypeUtilities::ExpectRetrievedValueIsArray(
246
            'valueAddedTaxIncluded',
247
            $this->RetrievePropertyValueFromData('valueAddedTaxIncluded'),
248
            static::class
249
        );
250
251
        return $out;
252
    }
253
254
    /**
255
    * @param array<int, bool> $value
256
    */
257
    public function SetValueAddedTaxIncluded(array $value) : void
258
    {
259
        $this->NudgePropertyWithUniqueBooleans(
260
            'valueAddedTaxIncluded',
261
            $value
262
        );
263
    }
264
}
265