OrderModel::__construct()   B
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 36
Code Lines 17

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 18
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 17
nc 1
nop 17
dl 0
loc 36
ccs 18
cts 18
cp 1
crap 1
rs 8.8571
c 0
b 0
f 0

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
 * @author  Fabian Hanisch
4
 * @since   18.07.2017 20:32
5
 * @version 1.0
6
 */
7
8
namespace HanischIt\KrakenApi\Call\Shared\Model;
9
10
/**
11
 * Class OrderModel
12
 * @package HanischIt\KrakenApi\Call\Shared\Model
13
 */
14
class OrderModel
15
{
16
    /**
17
     * @var string
18
     */
19
    private $txId;
20
    /**
21
     * @var float
22
     */
23
    private $cost;
24
    /**
25
     * @var OrderTypeModel
26
     */
27
    private $orderDetails;
28
    /**
29
     * @var int
30
     */
31
    private $expiretm;
32
    /**
33
     * @var float
34
     */
35
    private $fee;
36
    /**
37
     * @var string
38
     */
39
    private $misc;
40
    /**
41
     * @var string
42
     */
43
    private $oflags;
44
    /**
45
     * @var int
46
     */
47
    private $opentm;
48
    /**
49
     * @var float
50
     */
51
    private $price;
52
    /**
53
     * @var string
54
     */
55
    private $refid;
56
    /**
57
     * @var int
58
     */
59
    private $starttm;
60
    /**
61
     * @var string
62
     */
63
    private $status;
64
    /**
65
     * @var string
66
     */
67
    private $userref;
68
    /**
69
     * @var float
70
     */
71
    private $vol;
72
    /**
73
     * @varfloat
74
     */
75
    private $vol_exec;
76
    private $closeTm;
77
    private $reason;
78
79
    /**
80
     * OpenOrderModel constructor.
81
     *
82
     * @param string $txid
83
     * @param string $closeTm
84
     * @param float $cost
85
     * @param OrderTypeModel $orderDetails
86
     * @param int $expiretm
87
     * @param float $fee
88
     * @param string $misc
89
     * @param string $oflags
90
     * @param int $opentm
91
     * @param float $price
92
     * @param string $reason
93
     * @param string $refid
94
     * @param int $starttm
95
     * @param string $status
96
     * @param string $userref
97
     * @param float $vol
98
     * @param float $vol_exec
99
     */
100 3
    public function __construct(
101
        $txid,
102
        $closeTm,
103
        $cost,
104
        OrderTypeModel $orderDetails,
105
        $expiretm,
106
        $fee,
107
        $misc,
108
        $oflags,
109
        $opentm,
110
        $price,
111
        $reason,
112
        $refid,
113
        $starttm,
114
        $status,
115
        $userref,
116
        $vol,
117
        $vol_exec
118
    ) {
119 3
        $this->txId = $txid;
120 3
        $this->cost = $cost;
121 3
        $this->orderDetails = $orderDetails;
122 3
        $this->expiretm = $expiretm;
123 3
        $this->fee = $fee;
124 3
        $this->misc = $misc;
125 3
        $this->oflags = $oflags;
126 3
        $this->opentm = $opentm;
127 3
        $this->price = $price;
128 3
        $this->refid = $refid;
129 3
        $this->starttm = $starttm;
130 3
        $this->status = $status;
131 3
        $this->userref = $userref;
132 3
        $this->vol = $vol;
133 3
        $this->vol_exec = $vol_exec;
134 3
        $this->closeTm = $closeTm;
135 3
        $this->reason = $reason;
136 3
    }
137
138
    /**
139
     * @return string
140
     */
141 3
    public function getTxId()
142
    {
143 3
        return $this->txId;
144
    }
145
146
147
    /**
148
     * @return mixed
149
     */
150 3
    public function getCost()
151
    {
152 3
        return $this->cost;
153
    }
154
155
    /**
156
     * @return OrderTypeModel
157
     */
158 3
    public function getOrderDetails()
159
    {
160 3
        return $this->orderDetails;
161
    }
162
163
    /**
164
     * @return int
165
     */
166 3
    public function getExpiretm()
167
    {
168 3
        return $this->expiretm;
169
    }
170
171
    /**
172
     * @return float
173
     */
174 3
    public function getFee()
175
    {
176 3
        return $this->fee;
177
    }
178
179
    /**
180
     * @return string
181
     */
182 3
    public function getMisc()
183
    {
184 3
        return $this->misc;
185
    }
186
187
    /**
188
     * @return string
189
     */
190 3
    public function getOflags()
191
    {
192 3
        return $this->oflags;
193
    }
194
195
    /**
196
     * @return int
197
     */
198 3
    public function getOpentm()
199
    {
200 3
        return $this->opentm;
201
    }
202
203
    /**
204
     * @return float
205
     */
206 3
    public function getPrice()
207
    {
208 3
        return $this->price;
209
    }
210
211
    /**
212
     * @return string
213
     */
214 3
    public function getRefid()
215
    {
216 3
        return $this->refid;
217
    }
218
219
    /**
220
     * @return int
221
     */
222 3
    public function getStarttm()
223
    {
224 3
        return $this->starttm;
225
    }
226
227
    /**
228
     * @return string
229
     */
230 3
    public function getStatus()
231
    {
232 3
        return $this->status;
233
    }
234
235
    /**
236
     * @return string
237
     */
238 3
    public function getUserref()
239
    {
240 3
        return $this->userref;
241
    }
242
243
    /**
244
     * @return float
245
     */
246 3
    public function getVol()
247
    {
248 3
        return $this->vol;
249
    }
250
251
    /**
252
     * @return mixed
253
     */
254 3
    public function getVolExec()
255
    {
256 3
        return $this->vol_exec;
257
    }
258
259
    /**
260
     * @return string
261
     */
262 2
    public function getCloseTm()
263
    {
264 2
        return $this->closeTm;
265
    }
266
267
    /**
268
     * @return string
269
     */
270 2
    public function getReason()
271
    {
272 2
        return $this->reason;
273
    }
274
}
275