Completed
Pull Request — master (#5)
by Laurent
02:35 queued 42s
created

CreateReceiverMonthBillCommand::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 21
Code Lines 19

Duplication

Lines 21
Ratio 100 %

Importance

Changes 0
Metric Value
cc 1
eloc 19
nc 1
nop 9
dl 21
loc 21
rs 9.3142
c 0
b 0
f 0

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
require_once __DIR__ . '/../class/billing/monthly/MonthlyFlightBill.php';
4
require_once __DIR__.'/CommandInterface.php';
5
6
/**
7
 * @author Laurent De Coninck <[email protected]>
8
 */
9
class CreateReceiverMonthBillCommand implements CommandInterface
10
{
11
    /**
12
     * @var MonthlyFlightBill
13
     */
14
    private $monthlyFlightBill;
15
16
    /**
17
     * @var int
18
     */
19
    private $billingType;
20
21
    /**
22
     * @var int
23
     */
24
    private $billType;
25
26
    /**
27
     * @var int
28
     */
29
    private $billingCondition;
30
31
    /**
32
     * @var int
33
     */
34
    private $modelDocument;
35
36
    /**
37
     * @var string
38
     */
39
    private $publicNote;
40
41
    /**
42
     * @var string
43
     */
44
    private $privateNote;
45
46
    /**
47
     * @var int
48
     */
49
    private $year;
50
51
    /**
52
     * @var int
53
     */
54
    private $month;
55
56
    /**
57
     * @param MonthlyFlightBill $monthlyFlightBill
58
     * @param int               $billingType
59
     * @param int               $billType
60
     * @param int               $billingCondition
61
     * @param int               $modelDocument
62
     * @param string            $publicNote
63
     * @param string            $privateNote
64
     * @param int               $year
65
     * @param int               $month
66
     */
67 View Code Duplication
    public function __construct(
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
68
        MonthlyFlightBill $monthlyFlightBill,
69
        $billingType,
70
        $billType,
71
        $billingCondition,
72
        $modelDocument,
73
        $publicNote,
74
        $privateNote,
75
        $year,
76
        $month
77
    ) {
78
        $this->monthlyFlightBill = $monthlyFlightBill;
79
        $this->billingType = $billingType;
80
        $this->billType = $billType;
81
        $this->billingCondition = $billingCondition;
82
        $this->modelDocument = $modelDocument;
83
        $this->publicNote = $publicNote;
84
        $this->privateNote = $privateNote;
85
        $this->year = $year;
86
        $this->month = $month;
87
    }
88
89
90
    /**
91
     * @return int
92
     */
93
    public function getReceiverId()
94
    {
95
        return $this->monthlyFlightBill->getReceiverId();
96
    }
97
98
    /**
99
     * @return array|Bbcvols[]
100
     */
101
    public function getFlights()
102
    {
103
        return $this->monthlyFlightBill->getFlights();
104
    }
105
106
    /**
107
     * @return MonthlyFlightBill
108
     */
109
    public function getMonthlyFlightBill()
110
    {
111
        return $this->monthlyFlightBill;
112
    }
113
114
    /**
115
     * @return int
116
     */
117
    public function getBillingType()
118
    {
119
        return $this->billingType;
120
    }
121
122
    /**
123
     * @return int
124
     */
125
    public function getBillType()
126
    {
127
        return $this->billType;
128
    }
129
130
    /**
131
     * @return int
132
     */
133
    public function getBillingCondition()
134
    {
135
        return $this->billingCondition;
136
    }
137
138
    /**
139
     * @return int
140
     */
141
    public function getModelDocument()
142
    {
143
        return $this->modelDocument;
144
    }
145
146
    /**
147
     * @return string
148
     */
149
    public function getPublicNote()
150
    {
151
        return $this->publicNote;
152
    }
153
154
    /**
155
     * @return string
156
     */
157
    public function getPrivateNote()
158
    {
159
        return $this->privateNote;
160
    }
161
162
    /**
163
     * @return int
164
     */
165
    public function getYear()
166
    {
167
        return $this->year;
168
    }
169
170
    /**
171
     * @return int
172
     */
173
    public function getMonth()
174
    {
175
        return $this->month;
176
    }
177
}