RepaymentSpecification::SetLoanPaymentFrequency()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 1
dl 0
loc 5
ccs 4
cts 4
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->NudgePropertyValue(
76 1
            'downPayment',
77 1
            $value
78
        );
79 1
    }
80
81
    /**
82
    * @return array<int, MonetaryAmount>
83
    */
84 4
    public function GetEarlyPrepaymentPenalty() : array
85
    {
86
        /**
87
        * @var array<int, MonetaryAmount>
88
        */
89 4
        $out = TypeUtilities::ExpectRetrievedValueIsArray(
90 4
            'earlyPrepaymentPenalty',
91 4
            $this->RetrievePropertyValueFromData('earlyPrepaymentPenalty'),
92 4
            static::class
93
        );
94
95 4
        return $out;
96
    }
97
98
    /**
99
    * @param array<int, MonetaryAmount> $value
100
    */
101 1
    public function SetEarlyPrepaymentPenalty(array $value) : void
102
    {
103 1
        $this->NudgePropertyValue(
104 1
            'earlyPrepaymentPenalty',
105 1
            $value
106
        );
107 1
    }
108
109
    /**
110
    * @return array<int, MonetaryAmount>
111
    */
112 4
    public function GetLoanPaymentAmount() : array
113
    {
114
        /**
115
        * @var array<int, MonetaryAmount>
116
        */
117 4
        $out = TypeUtilities::ExpectRetrievedValueIsArray(
118 4
            'loanPaymentAmount',
119 4
            $this->RetrievePropertyValueFromData('loanPaymentAmount'),
120 4
            static::class
121
        );
122
123 4
        return $out;
124
    }
125
126
    /**
127
    * @param array<int, MonetaryAmount> $value
128
    */
129 1
    public function SetLoanPaymentAmount(array $value) : void
130
    {
131 1
        $this->NudgePropertyValue(
132 1
            'loanPaymentAmount',
133 1
            $value
134
        );
135 1
    }
136
137
    /**
138
    * @return array<int, int|float>
139
    */
140 4
    public function GetLoanPaymentFrequency() : array
141
    {
142
        /**
143
        * @var array<int, int|float>
144
        */
145 4
        $out = TypeUtilities::ExpectRetrievedValueIsArray(
146 4
            'loanPaymentFrequency',
147 4
            $this->RetrievePropertyValueFromData('loanPaymentFrequency'),
148 4
            static::class
149
        );
150
151 4
        return $out;
152
    }
153
154
    /**
155
    * @param array<int, int|float> $value
156
    */
157 1
    public function SetLoanPaymentFrequency(array $value) : void
158
    {
159 1
        $this->NudgePropertyValue(
160 1
            'loanPaymentFrequency',
161 1
            $value
162
        );
163 1
    }
164
165
    /**
166
    * @return array<int, int|float>
167
    */
168 4
    public function GetNumberOfLoanPayments() : array
169
    {
170
        /**
171
        * @var array<int, int|float>
172
        */
173 4
        $out = TypeUtilities::ExpectRetrievedValueIsArray(
174 4
            'numberOfLoanPayments',
175 4
            $this->RetrievePropertyValueFromData('numberOfLoanPayments'),
176 4
            static::class
177
        );
178
179 4
        return $out;
180
    }
181
182
    /**
183
    * @param array<int, int|float> $value
184
    */
185 1
    public function SetNumberOfLoanPayments(array $value) : void
186
    {
187 1
        $this->NudgePropertyValue(
188 1
            'numberOfLoanPayments',
189 1
            $value
190
        );
191 1
    }
192
}
193