Passed
Branch master (d0211e)
by Willy
02:44
created

RewardItemValueObject::__construct()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 35
Code Lines 33

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 35
ccs 0
cts 35
cp 0
rs 8.8571
c 0
b 0
f 0
cc 1
eloc 33
nc 1
nop 16
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\Shared\RewardItem\Model;
4
5
/**
6
 * @author  Willy Reiche
7
 * @since   2017-12-06
8
 * @version 1.0
9
 */
10
class RewardItemValueObject
11
{
12
    /**
13
     * @var int
14
     */
15
    private $id;
16
    /**
17
     * @var string
18
     */
19
    private $name;
20
    /**
21
     * @var string
22
     */
23
    private $icon;
24
    /**
25
     * @var int
26
     */
27
    private $quality;
28
    /**
29
     * @var int
30
     */
31
    private $itemLevel;
32
    /**
33
     * @var array
34
     */
35
    private $tooltipParams;
36
    /**
37
     * @var array
38
     */
39
    private $stats;
40
    /**
41
     * @var int
42
     */
43
    private $armor;
44
    /**
45
     * @var string
46
     */
47
    private $context;
48
    /**
49
     * @var array
50
     */
51
    private $bonusLists;
52
    /**
53
     * @var int
54
     */
55
    private $artifactId;
56
    /**
57
     * @var int
58
     */
59
    private $displayInfoId;
60
    /**
61
     * @var int
62
     */
63
    private $artifactAppearanceId;
64
    /**
65
     * @var array
66
     */
67
    private $artifactTraits;
68
    /**
69
     * @var array
70
     */
71
    private $relics;
72
    /**
73
     * @var array
74
     */
75
    private $appearance;
76
77
    /**
78
     * RewardItemValueObject constructor.
79
     * @param int    $id
80
     * @param string $name
81
     * @param string $icon
82
     * @param int    $quality
83
     * @param int    $itemLevel
84
     * @param array  $tooltipParams
85
     * @param array  $stats
86
     * @param int    $armor
87
     * @param string $context
88
     * @param array  $bonusLists
89
     * @param int    $artifactId
90
     * @param int    $displayInfoId
91
     * @param int    $artifactAppearanceId
92
     * @param array  $artifactTraits
93
     * @param array  $relics
94
     * @param array  $appearance
95
     */
96
    public function __construct(
97
        $id,
98
        $name,
99
        $icon,
100
        $quality,
101
        $itemLevel,
102
        $tooltipParams,
103
        $stats,
104
        $armor,
105
        $context,
106
        $bonusLists,
107
        $artifactId,
108
        $displayInfoId,
109
        $artifactAppearanceId,
110
        $artifactTraits,
111
        $relics,
112
        $appearance
113
    ) {
114
        $this->id = $id;
115
        $this->name = $name;
116
        $this->icon = $icon;
117
        $this->quality = $quality;
118
        $this->itemLevel = $itemLevel;
119
        $this->tooltipParams = $tooltipParams;
120
        $this->stats = $stats;
121
        $this->armor = $armor;
122
        $this->context = $context;
123
        $this->bonusLists = $bonusLists;
124
        $this->artifactId = $artifactId;
125
        $this->displayInfoId = $displayInfoId;
126
        $this->artifactAppearanceId = $artifactAppearanceId;
127
        $this->artifactTraits = $artifactTraits;
128
        $this->relics = $relics;
129
        $this->appearance = $appearance;
130
    }
131
132
    /**
133
     * @return int
134
     */
135
    public function getId()
136
    {
137
        return $this->id;
138
    }
139
140
    /**
141
     * @return string
142
     */
143
    public function getName()
144
    {
145
        return $this->name;
146
    }
147
148
    /**
149
     * @return string
150
     */
151
    public function getIcon()
152
    {
153
        return $this->icon;
154
    }
155
156
    /**
157
     * @return int
158
     */
159
    public function getQuality()
160
    {
161
        return $this->quality;
162
    }
163
164
    /**
165
     * @return int
166
     */
167
    public function getItemLevel()
168
    {
169
        return $this->itemLevel;
170
    }
171
172
    /**
173
     * @return array
174
     */
175
    public function getTooltipParams()
176
    {
177
        return $this->tooltipParams;
178
    }
179
180
    /**
181
     * @return array
182
     */
183
    public function getStats()
184
    {
185
        return $this->stats;
186
    }
187
188
    /**
189
     * @return int
190
     */
191
    public function getArmor()
192
    {
193
        return $this->armor;
194
    }
195
196
    /**
197
     * @return string
198
     */
199
    public function getContext()
200
    {
201
        return $this->context;
202
    }
203
204
    /**
205
     * @return array
206
     */
207
    public function getBonusLists()
208
    {
209
        return $this->bonusLists;
210
    }
211
212
    /**
213
     * @return int
214
     */
215
    public function getArtifactId()
216
    {
217
        return $this->artifactId;
218
    }
219
220
    /**
221
     * @return int
222
     */
223
    public function getDisplayInfoId()
224
    {
225
        return $this->displayInfoId;
226
    }
227
228
    /**
229
     * @return int
230
     */
231
    public function getArtifactAppearanceId()
232
    {
233
        return $this->artifactAppearanceId;
234
    }
235
236
    /**
237
     * @return array
238
     */
239
    public function getArtifactTraits()
240
    {
241
        return $this->artifactTraits;
242
    }
243
244
    /**
245
     * @return array
246
     */
247
    public function getRelics()
248
    {
249
        return $this->relics;
250
    }
251
252
    /**
253
     * @return array
254
     */
255
    public function getAppearance()
256
    {
257
        return $this->appearance;
258
    }
259
}
260