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

BossValueObject::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 23
Code Lines 21

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 23
ccs 0
cts 23
cp 0
rs 9.0856
cc 1
eloc 21
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\Progression\Model;
4
5
/**
6
 * @author  Willy Reiche
7
 * @since   2017-07-28
8
 * @version 1.0
9
 */
10
class BossValueObject
11
{
12
    /**
13
     * @var int
14
     */
15
    private $id;
16
17
    /**
18
     * @var string
19
     */
20
    private $name;
21
22
    /**
23
     * @var int
24
     */
25
    private $lfrKills;
26
27
    /**
28
     * @var int
29
     */
30
    private $lfrTimestamp;
31
32
    /**
33
     * @var int
34
     */
35
    private $normalKills;
36
37
    /**
38
     * @var int
39
     */
40
    private $normalTimestamp;
41
42
    /**
43
     * @var int
44
     */
45
    private $heroicKills;
46
47
    /**
48
     * @var int
49
     */
50
    private $heroicTimestamp;
51
52
    /**
53
     * @var int
54
     */
55
    private $mythicKills;
56
57
    /**
58
     * @var int
59
     */
60
    private $mythicTimestamp;
61
62
    /**
63
     * BossValueObject constructor.
64
     * @param int    $id
65
     * @param string $name
66
     * @param int    $lfrKills
67
     * @param int    $lfrTimestamp
68
     * @param int    $normalKills
69
     * @param int    $normalTimestamp
70
     * @param int    $heroicKills
71
     * @param int    $heroicTimestamp
72
     * @param int    $mythicKills
73
     * @param int    $mythicTimestamp
74
     */
75
    public function __construct(
76
        $id,
77
        $name,
78
        $lfrKills,
79
        $lfrTimestamp,
80
        $normalKills,
81
        $normalTimestamp,
82
        $heroicKills,
83
        $heroicTimestamp,
84
        $mythicKills,
85
        $mythicTimestamp
86
    ) {
87
        $this->id = $id;
88
        $this->name = $name;
89
        $this->lfrKills = $lfrKills;
90
        $this->lfrTimestamp = $lfrTimestamp;
91
        $this->normalKills = $normalKills;
92
        $this->normalTimestamp = $normalTimestamp;
93
        $this->heroicKills = $heroicKills;
94
        $this->heroicTimestamp = $heroicTimestamp;
95
        $this->mythicKills = $mythicKills;
96
        $this->mythicTimestamp = $mythicTimestamp;
97
    }
98
99
    /**
100
     * @return int
101
     */
102
    public function getId()
103
    {
104
        return $this->id;
105
    }
106
107
    /**
108
     * @return string
109
     */
110
    public function getName()
111
    {
112
        return $this->name;
113
    }
114
115
    /**
116
     * @return int
117
     */
118
    public function getLfrKills()
119
    {
120
        return $this->lfrKills;
121
    }
122
123
    /**
124
     * @return int
125
     */
126
    public function getLfrTimestamp()
127
    {
128
        return $this->lfrTimestamp;
129
    }
130
131
    /**
132
     * @return int
133
     */
134
    public function getNormalKills()
135
    {
136
        return $this->normalKills;
137
    }
138
139
    /**
140
     * @return int
141
     */
142
    public function getNormalTimestamp()
143
    {
144
        return $this->normalTimestamp;
145
    }
146
147
    /**
148
     * @return int
149
     */
150
    public function getHeroicKills()
151
    {
152
        return $this->heroicKills;
153
    }
154
155
    /**
156
     * @return int
157
     */
158
    public function getHeroicTimestamp()
159
    {
160
        return $this->heroicTimestamp;
161
    }
162
163
    /**
164
     * @return int
165
     */
166
    public function getMythicKills()
167
    {
168
        return $this->mythicKills;
169
    }
170
171
    /**
172
     * @return int
173
     */
174
    public function getMythicTimestamp()
175
    {
176
        return $this->mythicTimestamp;
177
    }
178
}
179