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

BracketValueObject::__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\CharacterProfileApi\Pvp\Model;
4
5
/**
6
 * @author  Willy Reiche
7
 * @since   2017-07-28
8
 * @version 1.0
9
 */
10
class BracketValueObject
11
{
12
    /**
13
     * @var string
14
     */
15
    private $slug;
16
17
    /**
18
     * @var int
19
     */
20
    private $rating;
21
22
    /**
23
     * @var int
24
     */
25
    private $weeklyPlayed;
26
27
    /**
28
     * @var int
29
     */
30
    private $weeklyWon;
31
32
    /**
33
     * @var int
34
     */
35
    private $weeklyLost;
36
37
    /**
38
     * @var int
39
     */
40
    private $seasonPlayed;
41
42
    /**
43
     * @var int
44
     */
45
    private $seasonWon;
46
47
    /**
48
     * @var int
49
     */
50
    private $seasonLost;
51
52
    /**
53
     * BracketValueObject constructor.
54
     * @param string $slug
55
     * @param int    $rating
56
     * @param int    $weeklyPlayed
57
     * @param int    $weeklyWon
58
     * @param int    $weeklyLost
59
     * @param int    $seasonPlayed
60
     * @param int    $seasonWon
61
     * @param int    $seasonLost
62
     */
63
    public function __construct(
64
        $slug,
65
        $rating,
66
        $weeklyPlayed,
67
        $weeklyWon,
68
        $weeklyLost,
69
        $seasonPlayed,
70
        $seasonWon,
71
        $seasonLost
72
    ) {
73
        $this->slug = $slug;
74
        $this->rating = $rating;
75
        $this->weeklyPlayed = $weeklyPlayed;
76
        $this->weeklyWon = $weeklyWon;
77
        $this->weeklyLost = $weeklyLost;
78
        $this->seasonPlayed = $seasonPlayed;
79
        $this->seasonWon = $seasonWon;
80
        $this->seasonLost = $seasonLost;
81
    }
82
83
    /**
84
     * @return string
85
     */
86
    public function getSlug()
87
    {
88
        return $this->slug;
89
    }
90
91
    /**
92
     * @return int
93
     */
94
    public function getRating()
95
    {
96
        return $this->rating;
97
    }
98
99
    /**
100
     * @return int
101
     */
102
    public function getWeeklyPlayed()
103
    {
104
        return $this->weeklyPlayed;
105
    }
106
107
    /**
108
     * @return int
109
     */
110
    public function getWeeklyWon()
111
    {
112
        return $this->weeklyWon;
113
    }
114
115
    /**
116
     * @return int
117
     */
118
    public function getWeeklyLost()
119
    {
120
        return $this->weeklyLost;
121
    }
122
123
    /**
124
     * @return int
125
     */
126
    public function getSeasonPlayed()
127
    {
128
        return $this->seasonPlayed;
129
    }
130
131
    /**
132
     * @return int
133
     */
134
    public function getSeasonWon()
135
    {
136
        return $this->seasonWon;
137
    }
138
139
    /**
140
     * @return int
141
     */
142
    public function getSeasonLost()
143
    {
144
        return $this->seasonLost;
145
    }
146
}
147