Passed
Push — master ( 80a2af...b754d5 )
by Fabian
51s
created

TradeModel::__construct()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 26
Code Lines 12

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 13
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 12
nc 1
nop 12
dl 0
loc 26
ccs 13
cts 13
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
 * Created by PhpStorm.
4
 * User: fabia
5
 * Date: 27.08.2017
6
 * Time: 19:32
7
 */
8
9
namespace HanischIt\KrakenApi\Call\TradesHistory\Model;
10
11
/**
12
 * Class TradeModel
13
 * @package HanischIt\KrakenApi\Call\TradesHistory\Model
14
 */
15
class TradeModel
16
{
17
    /**
18
     * @var string
19
     */
20
    private $ordertxid;
21
    /**
22
     * @var string
23
     */
24
    private $pair;
25
    /**
26
     * @var int
27
     */
28
    private $time;
29
    /**
30
     * @var string
31
     */
32
    private $type;
33
    /**
34
     * @var string
35
     */
36
    private $ordertype;
37
    /**
38
     * @var float
39
     */
40
    private $price;
41
    /**
42
     * @var float
43
     */
44
    private $cost;
45
    /**
46
     * @var float
47
     */
48
    private $fee;
49
    /**
50
     * @var float
51
     */
52
    private $vol;
53
    /**
54
     * @var float
55
     */
56
    private $margin;
57
    /**
58
     * @var string
59
     */
60
    private $misc;
61
    /**
62
     * @var string
63
     */
64
    private $closing;
65
66
    /**
67
     * Trade constructor.
68
     * @param string $ordertxid
69
     * @param string $pair
70
     * @param int $time
71
     * @param string $type
72
     * @param string $ordertype
73
     * @param float $price
74
     * @param float $cost
75
     * @param float $fee
76
     * @param float $vol
77
     * @param float $margin
78
     * @param string $misc
79
     * @param string $closing
80
     */
81 2
    public function __construct(
82
        $ordertxid,
83
        $pair,
84
        $time,
85
        $type,
86
        $ordertype,
87
        $price,
88
        $cost,
89
        $fee,
90
        $vol,
91
        $margin,
92
        $misc,
93
        $closing
94
    ) {
95 2
        $this->ordertxid = $ordertxid;
96 2
        $this->pair = $pair;
97 2
        $this->time = $time;
98 2
        $this->type = $type;
99 2
        $this->ordertype = $ordertype;
100 2
        $this->price = $price;
101 2
        $this->cost = $cost;
102 2
        $this->fee = $fee;
103 2
        $this->vol = $vol;
104 2
        $this->margin = $margin;
105 2
        $this->misc = $misc;
106 2
        $this->closing = $closing;
107 2
    }
108
109
110
    /**
111
     * @return string
112
     */
113 2
    public function getOrdertxid()
114
    {
115 2
        return $this->ordertxid;
116
    }
117
118
    /**
119
     * @return string
120
     */
121 2
    public function getPair()
122
    {
123 2
        return $this->pair;
124
    }
125
126
    /**
127
     * @return int
128
     */
129 2
    public function getTime()
130
    {
131 2
        return $this->time;
132
    }
133
134
    /**
135
     * @return string
136
     */
137 2
    public function getType()
138
    {
139 2
        return $this->type;
140
    }
141
142
    /**
143
     * @return string
144
     */
145 2
    public function getOrdertype()
146
    {
147 2
        return $this->ordertype;
148
    }
149
150
    /**
151
     * @return float
152
     */
153 2
    public function getPrice()
154
    {
155 2
        return $this->price;
156
    }
157
158
    /**
159
     * @return float
160
     */
161 2
    public function getCost()
162
    {
163 2
        return $this->cost;
164
    }
165
166
    /**
167
     * @return float
168
     */
169 2
    public function getFee()
170
    {
171 2
        return $this->fee;
172
    }
173
174
    /**
175
     * @return float
176
     */
177 2
    public function getVol()
178
    {
179 2
        return $this->vol;
180
    }
181
182
    /**
183
     * @return float
184
     */
185 2
    public function getMargin()
186
    {
187 2
        return $this->margin;
188
    }
189
190
    /**
191
     * @return string
192
     */
193 2
    public function getMisc()
194
    {
195 2
        return $this->misc;
196
    }
197
198
    /**
199
     * @return string
200
     */
201 2
    public function getClosing()
202
    {
203 2
        return $this->closing;
204
    }
205
}
206