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

MountValueObject::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 23
Code Lines 21

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 12
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 23
ccs 12
cts 12
cp 1
rs 9.0856
cc 1
eloc 21
nc 1
nop 10
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-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 11
    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 11
        $this->name = $name;
88 11
        $this->spellId = $spellId;
89 11
        $this->creatureId = $creatureId;
90 11
        $this->itemId = $itemId;
91 11
        $this->qualityId = $qualityId;
92 11
        $this->icon = $icon;
93 11
        $this->isGrounded = $isGrounded;
94 11
        $this->isFlying = $isFlying;
95 11
        $this->isAquatic = $isAquatic;
96 11
        $this->isJumping = $isJumping;
97 11
    }
98
99
    /**
100
     * @return string
101
     */
102 1
    public function getName()
103
    {
104 1
        return $this->name;
105
    }
106
107
    /**
108
     * @return int
109
     */
110 1
    public function getSpellId()
111
    {
112 1
        return $this->spellId;
113
    }
114
115
    /**
116
     * @return int
117
     */
118 1
    public function getCreatureId()
119
    {
120 1
        return $this->creatureId;
121
    }
122
123
    /**
124
     * @return int
125
     */
126 1
    public function getItemId()
127
    {
128 1
        return $this->itemId;
129
    }
130
131
    /**
132
     * @return int
133
     */
134 1
    public function getQualityId()
135
    {
136 1
        return $this->qualityId;
137
    }
138
139
    /**
140
     * @return string
141
     */
142 1
    public function getIcon()
143
    {
144 1
        return $this->icon;
145
    }
146
147
    /**
148
     * @return bool
149
     */
150 1
    public function isGrounded()
151
    {
152 1
        return $this->isGrounded;
153
    }
154
155
    /**
156
     * @return bool
157
     */
158 1
    public function isFlying()
159
    {
160 1
        return $this->isFlying;
161
    }
162
163
    /**
164
     * @return bool
165
     */
166 1
    public function isAquatic()
167
    {
168 1
        return $this->isAquatic;
169
    }
170
171
    /**
172
     * @return bool
173
     */
174 1
    public function isJumping()
175
    {
176 1
        return $this->isJumping;
177
    }
178
}
179