HistoryItem::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 28
Code Lines 13

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 13
c 1
b 0
f 0
dl 0
loc 28
rs 9.8333
cc 1
nc 1
nop 13

How to fix   Many Parameters   

Many Parameters

Methods with many parameters are not only hard to understand, but their parameters also often become inconsistent when you need more, or different data.

There are several approaches to avoid long parameter lists:

1
<?php
2
3
declare(strict_types=1);
4
5
namespace Skrill\Response;
6
7
use DateTimeInterface;
8
9
/**
10
 * Class HistoryItem.
11
 */
12
final class HistoryItem
13
{
14
    /**
15
     * @var string
16
     */
17
    private $reference;
18
19
    /**
20
     * @var string
21
     */
22
    private $skrillId;
23
24
    /**
25
     * @var DateTimeInterface
26
     */
27
    private $time;
28
29
    /**
30
     * @var string
31
     */
32
    private $type;
33
34
    /**
35
     * @var string
36
     */
37
    private $details;
38
39
    /**
40
     * @var float
41
     */
42
    private $lesion;
43
44
    /**
45
     * @var float
46
     */
47
    private $profit;
48
49
    /**
50
     * @var string
51
     */
52
    private $status;
53
54
    /**
55
     * @var float
56
     */
57
    private $balance;
58
59
    /**
60
     * @var float
61
     */
62
    private $amount;
63
64
    /**
65
     * @var string
66
     */
67
    private $currency;
68
69
    /**
70
     * @var string
71
     */
72
    private $info;
73
74
    /**
75
     * @var string
76
     */
77
    private $paymentType;
78
79
    /**
80
     * @param $reference
81
     * @param $skrillId
82
     * @param DateTimeInterface $time
83
     * @param $type
84
     * @param $details
85
     * @param $lesion
86
     * @param $profit
87
     * @param $status
88
     * @param $balance
89
     * @param $amount
90
     * @param $currency
91
     * @param $info
92
     * @param $paymentType
93
     */
94
    public function __construct(
95
        $reference,
96
        $skrillId,
97
        DateTimeInterface $time,
98
        $type,
99
        $details,
100
        $lesion,
101
        $profit,
102
        $status,
103
        $balance,
104
        $amount,
105
        $currency,
106
        $info,
107
        $paymentType
108
    ) {
109
        $this->reference = $reference;
110
        $this->skrillId = $skrillId;
111
        $this->time = $time;
112
        $this->type = $type;
113
        $this->details = $details;
114
        $this->lesion = $lesion;
115
        $this->profit = $profit;
116
        $this->status = $status;
117
        $this->balance = $balance;
118
        $this->amount = $amount;
119
        $this->currency = $currency;
120
        $this->info = $info;
121
        $this->paymentType = $paymentType;
122
    }
123
124
    /**
125
     * @return string
126
     */
127
    public function getDetails()
128
    {
129
        return $this->details;
130
    }
131
132
    /**
133
     * @return string
134
     */
135
    public function getReference()
136
    {
137
        return $this->reference;
138
    }
139
140
    /**
141
     * @return string
142
     */
143
    public function getPaymentType()
144
    {
145
        return $this->paymentType;
146
    }
147
148
    /**
149
     * @return string
150
     */
151
    public function getInfo()
152
    {
153
        return $this->info;
154
    }
155
156
    /**
157
     * @return string
158
     */
159
    public function getCurrency()
160
    {
161
        return $this->currency;
162
    }
163
164
    /**
165
     * @return float
166
     */
167
    public function getAmount()
168
    {
169
        return $this->amount;
170
    }
171
172
    /**
173
     * @return float
174
     */
175
    public function getBalance()
176
    {
177
        return $this->balance;
178
    }
179
180
    /**
181
     * @return string
182
     */
183
    public function getStatus()
184
    {
185
        return $this->status;
186
    }
187
188
    /**
189
     * @return float
190
     */
191
    public function getProfit()
192
    {
193
        return $this->profit;
194
    }
195
196
    /**
197
     * @return float
198
     */
199
    public function getLesion()
200
    {
201
        return $this->lesion;
202
    }
203
204
    /**
205
     * @return string
206
     */
207
    public function getType()
208
    {
209
        return $this->type;
210
    }
211
212
    /**
213
     * @return DateTimeInterface
214
     */
215
    public function getTime()
216
    {
217
        return $this->time;
218
    }
219
220
    /**
221
     * @return string
222
     */
223
    public function getSkrillId()
224
    {
225
        return $this->skrillId;
226
    }
227
}
228