Test Failed
Push — master ( 67ec1c...f465f8 )
by Willy
06:35
created

PetValueObject::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 31

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 31
ccs 0
cts 31
cp 0
rs 9.424
c 0
b 0
f 0
cc 1
nc 1
nop 14
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\Collection\Model;
4
5
/**
6
 * @author  Willy Reiche
7
 * @since   2017-07-27
8
 * @version 1.0
9
 */
10
class PetValueObject
11
{
12
    /**
13
     * @var string
14
     */
15
    private $name;
16
17
    /**
18
     * @var int
19
     */
20
    private $spellId;
21
22
    /**
23
     * @var int
24
     */
25
    private $creatureId;
26
27
    /**
28
     * @var int
29
     */
30
    private $itemId;
31
32
    /**
33
     * @var int
34
     */
35
    private $qualityId;
36
37
    /**
38
     * @var string
39
     */
40
    private $icon;
41
42
    /**
43
     * @var PetStatValueObject
44
     */
45
    private $petStatValueObject;
46
47
    /**
48
     * @var string
49
     */
50
    private $battlePetGuid;
51
52
    /**
53
     * @var bool
54
     */
55
    private $isFavorite;
56
57
    /**
58
     * @var bool
59
     */
60
    private $isFirstAbilitySlotSelected;
61
62
    /**
63
     * @var bool
64
     */
65
    private $isSecondAbilitySlotSelected;
66
67
    /**
68
     * @var bool
69
     */
70
    private $isThirdAbilitySlotSelected;
71
72
    /**
73
     * @var string
74
     */
75
    private $creatureName;
76
77
    /**
78
     * @var bool
79
     */
80
    private $canBattle;
81
82
    /**
83
     * PetValueObject constructor.
84
     * @param string             $name
85
     * @param int                $spellId
86
     * @param int                $creatureId
87
     * @param int                $itemId
88
     * @param int                $qualityId
89
     * @param string             $icon
90
     * @param PetStatValueObject $petStatValueObject
91
     * @param string             $battlePetGuid
92
     * @param bool               $isFavorite
93
     * @param bool               $isFirstAbilitySlotSelected
94
     * @param bool               $isSecondAbilitySlotSelected
95
     * @param bool               $isThirdAbilitySlotSelected
96
     * @param string             $creatureName
97
     * @param bool               $canBattle
98
     */
99
    public function __construct(
100
        $name,
101
        $spellId,
102
        $creatureId,
103
        $itemId,
104
        $qualityId,
105
        $icon,
106
        PetStatValueObject $petStatValueObject,
107
        $battlePetGuid,
108
        $isFavorite,
109
        $isFirstAbilitySlotSelected,
110
        $isSecondAbilitySlotSelected,
111
        $isThirdAbilitySlotSelected,
112
        $creatureName,
113
        $canBattle
114
    ) {
115
        $this->name = $name;
116
        $this->spellId = $spellId;
117
        $this->creatureId = $creatureId;
118
        $this->itemId = $itemId;
119
        $this->qualityId = $qualityId;
120
        $this->icon = $icon;
121
        $this->petStatValueObject = $petStatValueObject;
122
        $this->battlePetGuid = $battlePetGuid;
123
        $this->isFavorite = $isFavorite;
124
        $this->isFirstAbilitySlotSelected = $isFirstAbilitySlotSelected;
125
        $this->isSecondAbilitySlotSelected = $isSecondAbilitySlotSelected;
126
        $this->isThirdAbilitySlotSelected = $isThirdAbilitySlotSelected;
127
        $this->creatureName = $creatureName;
128
        $this->canBattle = $canBattle;
129
    }
130
131
    /**
132
     * @return string
133
     */
134
    public function getName()
135
    {
136
        return $this->name;
137
    }
138
139
    /**
140
     * @return int
141
     */
142
    public function getSpellId()
143
    {
144
        return $this->spellId;
145
    }
146
147
    /**
148
     * @return int
149
     */
150
    public function getCreatureId()
151
    {
152
        return $this->creatureId;
153
    }
154
155
    /**
156
     * @return int
157
     */
158
    public function getItemId()
159
    {
160
        return $this->itemId;
161
    }
162
163
    /**
164
     * @return int
165
     */
166
    public function getQualityId()
167
    {
168
        return $this->qualityId;
169
    }
170
171
    /**
172
     * @return string
173
     */
174
    public function getIcon()
175
    {
176
        return $this->icon;
177
    }
178
179
    /**
180
     * @return PetStatValueObject
181
     */
182
    public function getPetStatValueObject()
183
    {
184
        return $this->petStatValueObject;
185
    }
186
187
    /**
188
     * @return string
189
     */
190
    public function getBattlePetGuid()
191
    {
192
        return $this->battlePetGuid;
193
    }
194
195
    /**
196
     * @return bool
197
     */
198
    public function isFavorite()
199
    {
200
        return $this->isFavorite;
201
    }
202
203
    /**
204
     * @return bool
205
     */
206
    public function isFirstAbilitySlotSelected()
207
    {
208
        return $this->isFirstAbilitySlotSelected;
209
    }
210
211
    /**
212
     * @return bool
213
     */
214
    public function isSecondAbilitySlotSelected()
215
    {
216
        return $this->isSecondAbilitySlotSelected;
217
    }
218
219
    /**
220
     * @return bool
221
     */
222
    public function isThirdAbilitySlotSelected()
223
    {
224
        return $this->isThirdAbilitySlotSelected;
225
    }
226
227
    /**
228
     * @return string
229
     */
230
    public function getCreatureName()
231
    {
232
        return $this->creatureName;
233
    }
234
235
    /**
236
     * @return bool
237
     */
238
    public function isCanBattle()
239
    {
240
        return $this->canBattle;
241
    }
242
}
243