Detail::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 18
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 9
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 8
dl 0
loc 18
ccs 9
cts 9
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 8
crap 1

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
namespace MrPrompt\CaixaEconomicaFederal\Received\Partial;
3
4
use MrPrompt\ShipmentCommon\Base\Authorization;
5
use MrPrompt\ShipmentCommon\Base\Billet;
6
use MrPrompt\ShipmentCommon\Base\Charge;
7
use MrPrompt\ShipmentCommon\Base\Customer;
8
use MrPrompt\ShipmentCommon\Base\Parcels;
9
use MrPrompt\ShipmentCommon\Base\Purchaser;
10
use MrPrompt\ShipmentCommon\Base\Seller;
11
use MrPrompt\ShipmentCommon\Base\Sequence;
12
13
/**
14
 * File detail
15
 *
16
 * @author Thiago Paes <[email protected]>
17
 */
18
class Detail extends \stdClass
19
{
20
    /**
21
     * Customer
22
     *
23
     * @var Customer
24
     */
25
    private $customer;
26
27
    /**
28
     * Charge
29
     *
30
     * @var charge
31
     */
32
    private $charge;
33
34
    /**
35
     * Seller
36
     *
37
     * @var Seller
38
     */
39
    private $seller;
40
41
    /**
42
     * Purchaser
43
     *
44
     * @var Purchaser
45
     */
46
    private $purchaser;
47
48
    /**
49
     * Parcels
50
     *
51
     * @var Parcels
52
     */
53
    private $parcels;
54
55
    /**
56
     * Authorization
57
     *
58
     * @var Authorization
59
     */
60
    private $authorization;
61
62
    /**
63
     * Billet
64
     *
65
     * @var Billet
66
     */
67
    private $billet;
68
69
    /**
70
     * Sequence
71
     *
72
     * @var Sequence
73
     */
74
    private $sequence;
75
76
    /**
77
     * Constructor
78
     *
79
     * @param Customer $customer
80
     * @param Charge $charge
81
     * @param Seller $seller
82
     * @param Purchaser $purchaser
83
     * @param Parcels $parcels
84
     * @param Authorization $authorization
85
     * @param Billet $billet
86
     * @param Sequence $sequence
87
     */
88 16
    public function __construct(
89
        Customer $customer,
90
        Charge $charge,
91
        Seller $seller,
92
        Purchaser $purchaser,
93
        Parcels $parcels,
94
        Authorization $authorization,
95
        Billet $billet,
96
        Sequence $sequence
97
    ) {
98 16
        $this->customer         = $customer;
99 16
        $this->charge           = $charge;
100 16
        $this->seller           = $seller;
101 16
        $this->purchaser        = $purchaser;
102 16
        $this->parcels          = $parcels;
103 16
        $this->authorization    = $authorization;
104 16
        $this->sequence         = $sequence;
105 16
        $this->billet           = $billet;
106 16
    }
107
108
    /**
109
     * @return Customer
110
     */
111 1
    public function getCustomer()
112
    {
113 1
        return $this->customer;
114
    }
115
116
    /**
117
     * @param Customer $customer
118
     */
119 1
    public function setCustomer(Customer $customer)
120
    {
121 1
        $this->customer = $customer;
122 1
    }
123
124
    /**
125
     * @return Charge
126
     */
127 1
    public function getCharge()
128
    {
129 1
        return $this->charge;
130
    }
131
132
    /**
133
     * @param Charge $charge
134
     */
135 1
    public function setCharge(Charge $charge)
136
    {
137 1
        $this->charge = $charge;
138 1
    }
139
140
    /**
141
     * @return Seller
142
     */
143 1
    public function getSeller()
144
    {
145 1
        return $this->seller;
146
    }
147
148
    /**
149
     * @param Seller $seller
150
     */
151 1
    public function setSeller(Seller $seller)
152
    {
153 1
        $this->seller = $seller;
154 1
    }
155
156
    /**
157
     * @return Purchaser
158
     */
159 1
    public function getPurchaser()
160
    {
161 1
        return $this->purchaser;
162
    }
163
164
    /**
165
     * @param Purchaser $purchaser
166
     */
167 1
    public function setPurchaser(Purchaser $purchaser)
168
    {
169 1
        $this->purchaser = $purchaser;
170 1
    }
171
172
    /**
173
     * @return Parcels
174
     */
175 1
    public function getParcels()
176
    {
177 1
        return $this->parcels;
178
    }
179
180
    /**
181
     * @param Parcels $parcels
182
     */
183 1
    public function setParcels(Parcels $parcels)
184
    {
185 1
        $this->parcels = $parcels;
186 1
    }
187
188
    /**
189
     * @return Authorization
190
     */
191 1
    public function getAuthorization()
192
    {
193 1
        return $this->authorization;
194
    }
195
196
    /**
197
     * @param Authorization $authorization
198
     */
199 1
    public function setAuthorization(Authorization $authorization)
200
    {
201 1
        $this->authorization = $authorization;
202 1
    }
203
204
    /**
205
     * @return Sequence
206
     */
207 1
    public function getSequence()
208
    {
209 1
        return $this->sequence;
210
    }
211
212
    /**
213
     * @param Sequence $sequence
214
     */
215 1
    public function setSequence(Sequence $sequence)
216
    {
217 1
        $this->sequence = $sequence;
218 1
    }
219
220
    /**
221
     * @return Billet
222
     */
223 1
    public function getBillet()
224
    {
225 1
        return $this->billet;
226
    }
227
228
    /**
229
     * @param Billet $billet
230
     */
231 1
    public function setBillet(Billet $billet)
232
    {
233 1
        $this->billet = $billet;
234 1
    }
235
}
236