Passed
Push — master ( 9f91ab...458136 )
by Willy
01:53
created

SpellValueObject::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 19
Code Lines 17

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 19
ccs 0
cts 19
cp 0
rs 9.4285
cc 1
eloc 17
nc 1
nop 8
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\Model;
4
5
/**
6
 * @author  Willy Reiche
7
 * @since   2017-08-01
8
 * @version 1.0
9
 */
10
class SpellValueObject
11
{
12
    /**
13
     * @var int
14
     */
15
    private $id;
16
17
    /**
18
     * @var string
19
     */
20
    private $name;
21
22
    /**
23
     * @var string
24
     */
25
    private $icon;
26
27
    /**
28
     * @var string
29
     */
30
    private $description;
31
32
    /**
33
     * @var string
34
     */
35
    private $castTime;
36
37
    /**
38
     * @var string
39
     */
40
    private $cooldown;
41
42
    /**
43
     * SpellValueObject constructor.
44
     * @param int    $id
45
     * @param string $name
46
     * @param string $icon
47
     * @param string $description
48
     * @param string $castTime
49
     * @param string $cooldown
50
     * @param string $powerCost
51
     * @param string $range
52
     */
53
    public function __construct(
54
        $id,
55
        $name,
56
        $icon,
57
        $description,
58
        $castTime,
59
        $cooldown,
60
        $range = "",
61
        $powerCost = ""
62
    ) {
63
        $this->id = $id;
64
        $this->name = $name;
65
        $this->icon = $icon;
66
        $this->description = $description;
67
        $this->castTime = $castTime;
68
        $this->cooldown = $cooldown;
69
        $this->range = $range;
70
        $this->powerCost = $powerCost;
71
    }
72
73
    /**
74
     * @var string
75
     */
76
    private $range;
77
78
    /**
79
     * @var string
80
     */
81
    private $powerCost;
82
83
    /**
84
     * @return int
85
     */
86
    public function getId()
87
    {
88
        return $this->id;
89
    }
90
91
    /**
92
     * @return string
93
     */
94
    public function getName()
95
    {
96
        return $this->name;
97
    }
98
99
    /**
100
     * @return string
101
     */
102
    public function getIcon()
103
    {
104
        return $this->icon;
105
    }
106
107
    /**
108
     * @return string
109
     */
110
    public function getDescription()
111
    {
112
        return $this->description;
113
    }
114
115
    /**
116
     * @return string
117
     */
118
    public function getCastTime()
119
    {
120
        return $this->castTime;
121
    }
122
123
    /**
124
     * @return string
125
     */
126
    public function getRange()
127
    {
128
        return $this->range;
129
    }
130
131
    /**
132
     * @return string
133
     */
134
    public function getPowerCost()
135
    {
136
        return $this->powerCost;
137
    }
138
139
    /**
140
     * @return string
141
     */
142
    public function getCooldown()
143
    {
144
        return $this->cooldown;
145
    }
146
}
147