Passed
Push — master ( f0b58d...371a9b )
by Fabian
02:51
created

Trade::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 14
Code Lines 12

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 13
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 12
c 1
b 0
f 0
nc 1
nop 12
dl 0
loc 14
ccs 13
cts 13
cp 1
crap 1
rs 9.4285

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