Passed
Push — master ( b9fa94...9233ac )
by Willy
01:57
created

OffensiveStatValueObject::__construct()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 27
Code Lines 25

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 27
ccs 0
cts 27
cp 0
rs 8.8571
cc 1
eloc 25
nc 1
nop 12
crap 2

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 Kubinashi\BattlenetApi\WorldOfWarcraft\CharacterProfileApi\Model\Stat;
4
5
/**
6
 * @author  Willy Reiche
7
 * @since   2017-08-26
8
 * @version 1.0
9
 */
10
class OffensiveStatValueObject
11
{
12
    /**
13
     * @var int
14
     */
15
    private $mainHandDmgMin;
16
    /**
17
     * @var int
18
     */
19
    private $mainHandDmgMax;
20
    /**
21
     * @var float
22
     */
23
    private $mainHandSpeed;
24
    /**
25
     * @var float
26
     */
27
    private $mainHandDps;
28
    /**
29
     * @var int
30
     */
31
    private $offHandDmgMin;
32
    /**
33
     * @var int
34
     */
35
    private $offHandDmgMax;
36
    /**
37
     * @var float
38
     */
39
    private $offHandSpeed;
40
    /**
41
     * @var float
42
     */
43
    private $offHandDps;
44
    /**
45
     * @var int
46
     */
47
    private $rangedDmgMin;
48
    /**
49
     * @var int
50
     */
51
    private $rangedDmgMax;
52
    /**
53
     * @var int
54
     */
55
    private $rangedSpeed;
56
    /**
57
     * @var float
58
     */
59
    private $rangedDps;
60
61
    /**
62
     * OffensiveStatValueObject constructor.
63
     * @param int   $mainHandDmgMin
64
     * @param int   $mainHandDmgMax
65
     * @param float $mainHandSpeed
66
     * @param float $mainHandDps
67
     * @param int   $offHandDmgMin
68
     * @param int   $offHandDmgMax
69
     * @param float $offHandSpeed
70
     * @param float $offHandDps
71
     * @param int   $rangedDmgMin
72
     * @param int   $rangedDmgMax
73
     * @param int   $rangedSpeed
74
     * @param float $rangedDps
75
     */
76
    public function __construct(
77
        $mainHandDmgMin,
78
        $mainHandDmgMax,
79
        $mainHandSpeed,
80
        $mainHandDps,
81
        $offHandDmgMin,
82
        $offHandDmgMax,
83
        $offHandSpeed,
84
        $offHandDps,
85
        $rangedDmgMin,
86
        $rangedDmgMax,
87
        $rangedSpeed,
88
        $rangedDps
89
    ) {
90
        $this->mainHandDmgMin = $mainHandDmgMin;
91
        $this->mainHandDmgMax = $mainHandDmgMax;
92
        $this->mainHandSpeed = $mainHandSpeed;
93
        $this->mainHandDps = $mainHandDps;
94
        $this->offHandDmgMin = $offHandDmgMin;
95
        $this->offHandDmgMax = $offHandDmgMax;
96
        $this->offHandSpeed = $offHandSpeed;
97
        $this->offHandDps = $offHandDps;
98
        $this->rangedDmgMin = $rangedDmgMin;
99
        $this->rangedDmgMax = $rangedDmgMax;
100
        $this->rangedSpeed = $rangedSpeed;
101
        $this->rangedDps = $rangedDps;
102
    }
103
104
    /**
105
     * @return int
106
     */
107
    public function getMainHandDmgMin()
108
    {
109
        return $this->mainHandDmgMin;
110
    }
111
112
    /**
113
     * @return int
114
     */
115
    public function getMainHandDmgMax()
116
    {
117
        return $this->mainHandDmgMax;
118
    }
119
120
    /**
121
     * @return float
122
     */
123
    public function getMainHandSpeed()
124
    {
125
        return $this->mainHandSpeed;
126
    }
127
128
    /**
129
     * @return float
130
     */
131
    public function getMainHandDps()
132
    {
133
        return $this->mainHandDps;
134
    }
135
136
    /**
137
     * @return int
138
     */
139
    public function getOffHandDmgMin()
140
    {
141
        return $this->offHandDmgMin;
142
    }
143
144
    /**
145
     * @return int
146
     */
147
    public function getOffHandDmgMax()
148
    {
149
        return $this->offHandDmgMax;
150
    }
151
152
    /**
153
     * @return float
154
     */
155
    public function getOffHandSpeed()
156
    {
157
        return $this->offHandSpeed;
158
    }
159
160
    /**
161
     * @return float
162
     */
163
    public function getOffHandDps()
164
    {
165
        return $this->offHandDps;
166
    }
167
168
    /**
169
     * @return int
170
     */
171
    public function getRangedDmgMin()
172
    {
173
        return $this->rangedDmgMin;
174
    }
175
176
    /**
177
     * @return int
178
     */
179
    public function getRangedDmgMax()
180
    {
181
        return $this->rangedDmgMax;
182
    }
183
184
    /**
185
     * @return int
186
     */
187
    public function getRangedSpeed()
188
    {
189
        return $this->rangedSpeed;
190
    }
191
192
    /**
193
     * @return float
194
     */
195
    public function getRangedDps()
196
    {
197
        return $this->rangedDps;
198
    }
199
}
200