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

MountValueObject::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 23

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 23
ccs 0
cts 23
cp 0
rs 9.552
c 0
b 0
f 0
cc 1
nc 1
nop 10
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-25
8
 * @version 1.0
9
 */
10
class MountValueObject
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 bool
44
     */
45
    private $isGrounded;
46
47
    /**
48
     * @var bool
49
     */
50
    private $isFlying;
51
52
    /**
53
     * @var bool
54
     */
55
    private $isAquatic;
56
57
    /**
58
     * @var bool
59
     */
60
    private $isJumping;
61
62
    /**
63
     * MountValueObject constructor.
64
     * @param string $name
65
     * @param int    $spellId
66
     * @param int    $creatureId
67
     * @param int    $itemId
68
     * @param int    $qualityId
69
     * @param string $icon
70
     * @param bool   $isGrounded
71
     * @param bool   $isFlying
72
     * @param bool   $isAquatic
73
     * @param bool   $isJumping
74
     */
75
    public function __construct(
76
        $name,
77
        $spellId,
78
        $creatureId,
79
        $itemId,
80
        $qualityId,
81
        $icon,
82
        $isGrounded,
83
        $isFlying,
84
        $isAquatic,
85
        $isJumping
86
    ) {
87
        $this->name = $name;
88
        $this->spellId = $spellId;
89
        $this->creatureId = $creatureId;
90
        $this->itemId = $itemId;
91
        $this->qualityId = $qualityId;
92
        $this->icon = $icon;
93
        $this->isGrounded = $isGrounded;
94
        $this->isFlying = $isFlying;
95
        $this->isAquatic = $isAquatic;
96
        $this->isJumping = $isJumping;
97
    }
98
99
    /**
100
     * @return string
101
     */
102
    public function getName()
103
    {
104
        return $this->name;
105
    }
106
107
    /**
108
     * @return int
109
     */
110
    public function getSpellId()
111
    {
112
        return $this->spellId;
113
    }
114
115
    /**
116
     * @return int
117
     */
118
    public function getCreatureId()
119
    {
120
        return $this->creatureId;
121
    }
122
123
    /**
124
     * @return int
125
     */
126
    public function getItemId()
127
    {
128
        return $this->itemId;
129
    }
130
131
    /**
132
     * @return int
133
     */
134
    public function getQualityId()
135
    {
136
        return $this->qualityId;
137
    }
138
139
    /**
140
     * @return string
141
     */
142
    public function getIcon()
143
    {
144
        return $this->icon;
145
    }
146
147
    /**
148
     * @return bool
149
     */
150
    public function isGrounded()
151
    {
152
        return $this->isGrounded;
153
    }
154
155
    /**
156
     * @return bool
157
     */
158
    public function isFlying()
159
    {
160
        return $this->isFlying;
161
    }
162
163
    /**
164
     * @return bool
165
     */
166
    public function isAquatic()
167
    {
168
        return $this->isAquatic;
169
    }
170
171
    /**
172
     * @return bool
173
     */
174
    public function isJumping()
175
    {
176
        return $this->isJumping;
177
    }
178
}
179