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

RepaymentSpecification   A

Complexity

Total Complexity 10

Size/Duplication

Total Lines 179
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 71
dl 0
loc 179
ccs 62
cts 62
cp 1
rs 10
c 0
b 0
f 0
wmc 10

10 Methods

Rating   Name   Duplication   Size   Complexity  
A SetDownPayment() 0 7 1
A GetLoanPaymentFrequency() 0 12 1
A SetNumberOfLoanPayments() 0 6 1
A SetLoanPaymentAmount() 0 7 1
A SetLoanPaymentFrequency() 0 6 1
A GetEarlyPrepaymentPenalty() 0 12 1
A GetDownPayment() 0 12 1
A GetLoanPaymentAmount() 0 12 1
A GetNumberOfLoanPayments() 0 12 1
A SetEarlyPrepaymentPenalty() 0 7 1
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