Passed
Branch fuzzy-generators (49fcec)
by SignpostMarv
08:30
created

PriceSpecification::SetPriceCurrency()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

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