Passed
Push — master ( 52dd57...a4c9fa )
by Willy
02:14
created

PetValueObject::__construct()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 31
Code Lines 29

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 16
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 31
ccs 16
cts 16
cp 1
rs 8.8571
cc 1
eloc 29
nc 1
nop 14
crap 1

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 15
    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 15
        $this->name = $name;
116 15
        $this->spellId = $spellId;
117 15
        $this->creatureId = $creatureId;
118 15
        $this->itemId = $itemId;
119 15
        $this->qualityId = $qualityId;
120 15
        $this->icon = $icon;
121 15
        $this->petStatValueObject = $petStatValueObject;
122 15
        $this->battlePetGuid = $battlePetGuid;
123 15
        $this->isFavorite = $isFavorite;
124 15
        $this->isFirstAbilitySlotSelected = $isFirstAbilitySlotSelected;
125 15
        $this->isSecondAbilitySlotSelected = $isSecondAbilitySlotSelected;
126 15
        $this->isThirdAbilitySlotSelected = $isThirdAbilitySlotSelected;
127 15
        $this->creatureName = $creatureName;
128 15
        $this->canBattle = $canBattle;
129 15
    }
130
131
    /**
132
     * @return string
133
     */
134 1
    public function getName()
135
    {
136 1
        return $this->name;
137
    }
138
139
    /**
140
     * @return int
141
     */
142 1
    public function getSpellId()
143
    {
144 1
        return $this->spellId;
145
    }
146
147
    /**
148
     * @return int
149
     */
150 1
    public function getCreatureId()
151
    {
152 1
        return $this->creatureId;
153
    }
154
155
    /**
156
     * @return int
157
     */
158 1
    public function getItemId()
159
    {
160 1
        return $this->itemId;
161
    }
162
163
    /**
164
     * @return int
165
     */
166 1
    public function getQualityId()
167
    {
168 1
        return $this->qualityId;
169
    }
170
171
    /**
172
     * @return string
173
     */
174 1
    public function getIcon()
175
    {
176 1
        return $this->icon;
177
    }
178
179
    /**
180
     * @return PetStatValueObject
181
     */
182 1
    public function getPetStatValueObject()
183
    {
184 1
        return $this->petStatValueObject;
185
    }
186
187
    /**
188
     * @return string
189
     */
190 1
    public function getBattlePetGuid()
191
    {
192 1
        return $this->battlePetGuid;
193
    }
194
195
    /**
196
     * @return bool
197
     */
198 1
    public function isFavorite()
199
    {
200 1
        return $this->isFavorite;
201
    }
202
203
    /**
204
     * @return bool
205
     */
206 1
    public function isFirstAbilitySlotSelected()
207
    {
208 1
        return $this->isFirstAbilitySlotSelected;
209
    }
210
211
    /**
212
     * @return bool
213
     */
214 1
    public function isSecondAbilitySlotSelected()
215
    {
216 1
        return $this->isSecondAbilitySlotSelected;
217
    }
218
219
    /**
220
     * @return bool
221
     */
222 1
    public function isThirdAbilitySlotSelected()
223
    {
224 1
        return $this->isThirdAbilitySlotSelected;
225
    }
226
227
    /**
228
     * @return string
229
     */
230 1
    public function getCreatureName()
231
    {
232 1
        return $this->creatureName;
233
    }
234
235
    /**
236
     * @return bool
237
     */
238 1
    public function isCanBattle()
239
    {
240 1
        return $this->canBattle;
241
    }
242
}
243