Passed
Push — develop ( 78e2d5...9c7a10 )
by Laurent
02:42 queued 01:21
created

EditSupplier::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 30
Code Lines 14

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 14
c 1
b 0
f 0
nc 1
nop 14
dl 0
loc 30
rs 9.7998

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
declare(strict_types=1);
4
5
/*
6
 * This file is part of the G.L.S.R. Apps package.
7
 *
8
 * (c) Dev-Int Création <[email protected]>.
9
 *
10
 * For the full copyright and license information, please view the LICENSE
11
 * file that was distributed with this source code.
12
 */
13
14
namespace Administration\Domain\Supplier\Command;
15
16
use Core\Domain\Common\Model\Dependent\FamilyLog;
17
use Core\Domain\Common\Model\VO\ContactUuid;
18
use Core\Domain\Common\Model\VO\EmailField;
19
use Core\Domain\Common\Model\VO\NameField;
20
use Core\Domain\Common\Model\VO\PhoneField;
21
use Core\Domain\Protocol\Common\Command\CommandProtocol;
22
23
class EditSupplier implements CommandProtocol
24
{
25
    private ContactUuid $uuid;
26
    private NameField $name;
27
    private string $address;
28
    private string $zipCode;
29
    private string $town;
30
    private string $country;
31
    private PhoneField $phone;
32
    private PhoneField $facsimile;
33
    private EmailField $email;
34
    private string $contact;
35
    private PhoneField $cellPhone;
36
    private FamilyLog $familyLog;
37
    private int $delayDelivery;
38
    private array $orderDays;
39
40
    public function __construct(
41
        ContactUuid $uuid,
42
        NameField $name,
43
        string $address,
44
        string $zipCode,
45
        string $town,
46
        string $country,
47
        PhoneField $phone,
48
        PhoneField $facsimile,
49
        EmailField $email,
50
        string $contact,
51
        PhoneField $cellPhone,
52
        FamilyLog $familyLog,
53
        int $delayDelivery,
54
        array $orderDays
55
    ) {
56
        $this->uuid = $uuid;
57
        $this->name = $name;
58
        $this->address = $address;
59
        $this->zipCode = $zipCode;
60
        $this->town = $town;
61
        $this->country = $country;
62
        $this->phone = $phone;
63
        $this->facsimile = $facsimile;
64
        $this->email = $email;
65
        $this->contact = $contact;
66
        $this->cellPhone = $cellPhone;
67
        $this->familyLog = $familyLog;
68
        $this->delayDelivery = $delayDelivery;
69
        $this->orderDays = $orderDays;
70
    }
71
72
    public function uuid(): ContactUuid
73
    {
74
        return $this->uuid;
75
    }
76
77
    public function name(): NameField
78
    {
79
        return $this->name;
80
    }
81
82
    public function address(): string
83
    {
84
        return $this->address;
85
    }
86
87
    public function zipCode(): string
88
    {
89
        return $this->zipCode;
90
    }
91
92
    public function town(): string
93
    {
94
        return $this->town;
95
    }
96
97
    public function country(): string
98
    {
99
        return $this->country;
100
    }
101
102
    public function phone(): PhoneField
103
    {
104
        return $this->phone;
105
    }
106
107
    public function facsimile(): PhoneField
108
    {
109
        return $this->facsimile;
110
    }
111
112
    public function email(): EmailField
113
    {
114
        return $this->email;
115
    }
116
117
    public function contact(): string
118
    {
119
        return $this->contact;
120
    }
121
122
    public function cellPhone(): PhoneField
123
    {
124
        return $this->cellPhone;
125
    }
126
127
    public function familyLog(): FamilyLog
128
    {
129
        return $this->familyLog;
130
    }
131
132
    public function delayDelivery(): int
133
    {
134
        return $this->delayDelivery;
135
    }
136
137
    public function orderDays(): array
138
    {
139
        return $this->orderDays;
140
    }
141
}
142