Completed
Push — master ( baee16...d38af1 )
by Fabian
02:13
created

OHLCDataModel::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 8
nc 1
nop 8
dl 0
loc 10
rs 9.4285
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
namespace HanischIt\KrakenApi\Model\OHLCData;
4
5
class OHLCDataModel
6
{
7
    /**
8
     * @var int
9
     */
10
    private $time;
11
    /**
12
     * @var float
13
     */
14
    private $open;
15
    /**
16
     * @var float
17
     */
18
    private $high;
19
    /**
20
     * @var float
21
     */
22
    private $low;
23
    /**
24
     * @var float
25
     */
26
    private $close;
27
    /**
28
     * @var float
29
     */
30
    private $vwap;
31
    /**
32
     * @var float
33
     */
34
    private $volume;
35
    /**
36
     * @var int
37
     */
38
    private $count;
39
40
    /**
41
     * OHLCDataModel constructor.
42
     * @param int $time
43
     * @param float $open
44
     * @param float $high
45
     * @param float $low
46
     * @param float $close
47
     * @param float $vwap
48
     * @param float $volume
49
     * @param int $count
50
     */
51
    public function __construct($time, $open, $high, $low, $close, $vwap, $volume, $count)
52
    {
53
        $this->time = $time;
54
        $this->open = $open;
55
        $this->high = $high;
56
        $this->low = $low;
57
        $this->close = $close;
58
        $this->vwap = $vwap;
59
        $this->volume = $volume;
60
        $this->count = $count;
61
    }
62
63
    /**
64
     * @return int
65
     */
66
    public function getTime()
67
    {
68
        return $this->time;
69
    }
70
71
    /**
72
     * @return float
73
     */
74
    public function getOpen()
75
    {
76
        return $this->open;
77
    }
78
79
    /**
80
     * @return float
81
     */
82
    public function getHigh()
83
    {
84
        return $this->high;
85
    }
86
87
    /**
88
     * @return float
89
     */
90
    public function getLow()
91
    {
92
        return $this->low;
93
    }
94
95
    /**
96
     * @return float
97
     */
98
    public function getClose()
99
    {
100
        return $this->close;
101
    }
102
103
    /**
104
     * @return float
105
     */
106
    public function getVwap()
107
    {
108
        return $this->vwap;
109
    }
110
111
    /**
112
     * @return float
113
     */
114
    public function getVolume()
115
    {
116
        return $this->volume;
117
    }
118
119
    /**
120
     * @return int
121
     */
122
    public function getCount()
123
    {
124
        return $this->count;
125
    }
126
}
127