Passed
Push — master ( b9fa94...9233ac )
by Willy
01:57
created

SecondaryStatValueObject::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 21
Code Lines 19

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 21
ccs 0
cts 21
cp 0
rs 9.3142
cc 1
eloc 19
nc 1
nop 9
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\Model\Stat;
4
5
/**
6
 * @author  Willy Reiche
7
 * @since   2017-08-26
8
 * @version 1.0
9
 */
10
class SecondaryStatValueObject
11
{
12
    /**
13
     * @var float
14
     */
15
    private $speedRating;
16
    /**
17
     * @var int
18
     */
19
    private $speedRatingBonus;
20
    /**
21
     * @var float
22
     */
23
    private $crit;
24
    /**
25
     * @var int
26
     */
27
    private $critRating;
28
    /**
29
     * @var float
30
     */
31
    private $haste;
32
    /**
33
     * @var int
34
     */
35
    private $hasteRating;
36
    /**
37
     * @var float
38
     */
39
    private $hasteRatingPercent;
40
    /**
41
     * @var float
42
     */
43
    private $mastery;
44
    /**
45
     * @var int
46
     */
47
    private $masteryRating;
48
49
    /**
50
     * SecondaryStatValueObject constructor.
51
     * @param float $speedRating
52
     * @param int   $speedRatingBonus
53
     * @param float $crit
54
     * @param int   $critRating
55
     * @param float $haste
56
     * @param int   $hasteRating
57
     * @param float $hasteRatingPercent
58
     * @param float $mastery
59
     * @param int   $masteryRating
60
     */
61
    public function __construct(
62
        $speedRating,
63
        $speedRatingBonus,
64
        $crit,
65
        $critRating,
66
        $haste,
67
        $hasteRating,
68
        $hasteRatingPercent,
69
        $mastery,
70
        $masteryRating
71
    ) {
72
        $this->speedRating = $speedRating;
73
        $this->speedRatingBonus = $speedRatingBonus;
74
        $this->crit = $crit;
75
        $this->critRating = $critRating;
76
        $this->haste = $haste;
77
        $this->hasteRating = $hasteRating;
78
        $this->hasteRatingPercent = $hasteRatingPercent;
79
        $this->mastery = $mastery;
80
        $this->masteryRating = $masteryRating;
81
    }
82
83
    /**
84
     * @return float
85
     */
86
    public function getSpeedRating()
87
    {
88
        return $this->speedRating;
89
    }
90
91
    /**
92
     * @return int
93
     */
94
    public function getSpeedRatingBonus()
95
    {
96
        return $this->speedRatingBonus;
97
    }
98
99
    /**
100
     * @return float
101
     */
102
    public function getCrit()
103
    {
104
        return $this->crit;
105
    }
106
107
    /**
108
     * @return int
109
     */
110
    public function getCritRating()
111
    {
112
        return $this->critRating;
113
    }
114
115
    /**
116
     * @return float
117
     */
118
    public function getHaste()
119
    {
120
        return $this->haste;
121
    }
122
123
    /**
124
     * @return int
125
     */
126
    public function getHasteRating()
127
    {
128
        return $this->hasteRating;
129
    }
130
131
    /**
132
     * @return float
133
     */
134
    public function getHasteRatingPercent()
135
    {
136
        return $this->hasteRatingPercent;
137
    }
138
139
    /**
140
     * @return float
141
     */
142
    public function getMastery()
143
    {
144
        return $this->mastery;
145
    }
146
147
    /**
148
     * @return int
149
     */
150
    public function getMasteryRating()
151
    {
152
        return $this->masteryRating;
153
    }
154
}
155