Passed
Push — master ( 81601f...461a97 )
by SignpostMarv
12:06
created

RepaymentSpecification::SetDownPayment()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 5
nc 1
nop 1
dl 0
loc 7
ccs 6
cts 6
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\Intangible\StructuredValue as Base;
10
use SignpostMarv\DaftObject\SchemaOrg\TypeUtilities;
11
12
/**
13
* @property array<int, int|float|MonetaryAmount> $downPayment
14
* @property array<int, MonetaryAmount> $earlyPrepaymentPenalty
15
* @property array<int, MonetaryAmount> $loanPaymentAmount
16
* @property array<int, int|float> $loanPaymentFrequency
17
* @property array<int, int|float> $numberOfLoanPayments
18
*/
19
class RepaymentSpecification extends Base
20
{
21
    const SCHEMA_ORG_TYPE = 'RepaymentSpecification';
22
23
    const PROPERTIES = [
24
        'downPayment',
25
        'earlyPrepaymentPenalty',
26
        'loanPaymentAmount',
27
        'loanPaymentFrequency',
28
        'numberOfLoanPayments',
29
    ];
30
31
    const PROPERTIES_WITH_MULTI_TYPED_ARRAYS = [
32
        'downPayment' => [
33
            'integer',
34
            'double',
35
            MonetaryAmount::class,
36
        ],
37
        'earlyPrepaymentPenalty' => [
38
            MonetaryAmount::class,
39
        ],
40
        'loanPaymentAmount' => [
41
            MonetaryAmount::class,
42
        ],
43
        'loanPaymentFrequency' => [
44
            'integer',
45
            'double',
46
        ],
47
        'numberOfLoanPayments' => [
48
            'integer',
49
            'double',
50
        ],
51
    ];
52
53
    /**
54
    * @return array<int, int|float|MonetaryAmount>
55
    */
56 4
    public function GetDownPayment() : array
57
    {
58
        /**
59
        * @var array<int, int|float|MonetaryAmount>
60
        */
61 4
        $out = TypeUtilities::ExpectRetrievedValueIsArray(
62 4
            'downPayment',
63 4
            $this->RetrievePropertyValueFromData('downPayment'),
64 4
            static::class
65
        );
66
67 4
        return $out;
68
    }
69
70
    /**
71
    * @param array<int, int|float|MonetaryAmount> $value
72
    */
73 1
    public function SetDownPayment(array $value) : void
74
    {
75 1
        $this->NudgePropertyWithUniqueNumericsOrThings(
76 1
            'downPayment',
77 1
            __METHOD__,
78 1
            $value,
79 1
            MonetaryAmount::class
80
        );
81 1
    }
82
83
    /**
84
    * @return array<int, MonetaryAmount>
85
    */
86 4
    public function GetEarlyPrepaymentPenalty() : array
87
    {
88
        /**
89
        * @var array<int, MonetaryAmount>
90
        */
91 4
        $out = TypeUtilities::ExpectRetrievedValueIsArray(
92 4
            'earlyPrepaymentPenalty',
93 4
            $this->RetrievePropertyValueFromData('earlyPrepaymentPenalty'),
94 4
            static::class
95
        );
96
97 4
        return $out;
98
    }
99
100
    /**
101
    * @param array<int, MonetaryAmount> $value
102
    */
103 1
    public function SetEarlyPrepaymentPenalty(array $value) : void
104
    {
105 1
        $this->NudgePropertyWithUniqueValuesOfThings(
106 1
            'earlyPrepaymentPenalty',
107 1
            __METHOD__,
108 1
            $value,
109 1
            MonetaryAmount::class
110
        );
111 1
    }
112
113
    /**
114
    * @return array<int, MonetaryAmount>
115
    */
116 4
    public function GetLoanPaymentAmount() : array
117
    {
118
        /**
119
        * @var array<int, MonetaryAmount>
120
        */
121 4
        $out = TypeUtilities::ExpectRetrievedValueIsArray(
122 4
            'loanPaymentAmount',
123 4
            $this->RetrievePropertyValueFromData('loanPaymentAmount'),
124 4
            static::class
125
        );
126
127 4
        return $out;
128
    }
129
130
    /**
131
    * @param array<int, MonetaryAmount> $value
132
    */
133 1
    public function SetLoanPaymentAmount(array $value) : void
134
    {
135 1
        $this->NudgePropertyWithUniqueValuesOfThings(
136 1
            'loanPaymentAmount',
137 1
            __METHOD__,
138 1
            $value,
139 1
            MonetaryAmount::class
140
        );
141 1
    }
142
143
    /**
144
    * @return array<int, int|float>
145
    */
146 4
    public function GetLoanPaymentFrequency() : array
147
    {
148
        /**
149
        * @var array<int, int|float>
150
        */
151 4
        $out = TypeUtilities::ExpectRetrievedValueIsArray(
152 4
            'loanPaymentFrequency',
153 4
            $this->RetrievePropertyValueFromData('loanPaymentFrequency'),
154 4
            static::class
155
        );
156
157 4
        return $out;
158
    }
159
160
    /**
161
    * @param array<int, int|float|string> $value
162
    */
163 1
    public function SetLoanPaymentFrequency(array $value) : void
164
    {
165 1
        $this->NudgePropertyWithUniqueIntegersOrFloats(
166 1
            'loanPaymentFrequency',
167 1
            __METHOD__,
168 1
            $value
169
        );
170 1
    }
171
172
    /**
173
    * @return array<int, int|float>
174
    */
175 4
    public function GetNumberOfLoanPayments() : array
176
    {
177
        /**
178
        * @var array<int, int|float>
179
        */
180 4
        $out = TypeUtilities::ExpectRetrievedValueIsArray(
181 4
            'numberOfLoanPayments',
182 4
            $this->RetrievePropertyValueFromData('numberOfLoanPayments'),
183 4
            static::class
184
        );
185
186 4
        return $out;
187
    }
188
189
    /**
190
    * @param array<int, int|float|string> $value
191
    */
192 1
    public function SetNumberOfLoanPayments(array $value) : void
193
    {
194 1
        $this->NudgePropertyWithUniqueIntegersOrFloats(
195 1
            'numberOfLoanPayments',
196 1
            __METHOD__,
197 1
            $value
198
        );
199 1
    }
200
}
201