Passed
Pull Request — develop (#155)
by Laurent
02:14
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\VO\ContactUuid;
17
use Core\Domain\Common\Model\VO\EmailField;
18
use Core\Domain\Common\Model\VO\NameField;
19
use Core\Domain\Common\Model\VO\PhoneField;
20
use Core\Domain\Protocol\Common\Command\CommandProtocol;
21
22
class EditSupplier implements CommandProtocol
23
{
24
    private ContactUuid $uuid;
25
    private NameField $name;
26
    private string $address;
27
    private string $zipCode;
28
    private string $town;
29
    private string $country;
30
    private PhoneField $phone;
31
    private PhoneField $facsimile;
32
    private EmailField $email;
33
    private string $contact;
34
    private PhoneField $cellPhone;
35
    private string $familyLogUuid;
36
    private int $delayDelivery;
37
    private array $orderDays;
38
39
    public function __construct(
40
        ContactUuid $uuid,
41
        NameField $name,
42
        string $address,
43
        string $zipCode,
44
        string $town,
45
        string $country,
46
        PhoneField $phone,
47
        PhoneField $facsimile,
48
        EmailField $email,
49
        string $contact,
50
        PhoneField $cellPhone,
51
        string $familyLogUuid,
52
        int $delayDelivery,
53
        array $orderDays
54
    ) {
55
        $this->uuid = $uuid;
56
        $this->name = $name;
57
        $this->address = $address;
58
        $this->zipCode = $zipCode;
59
        $this->town = $town;
60
        $this->country = $country;
61
        $this->phone = $phone;
62
        $this->facsimile = $facsimile;
63
        $this->email = $email;
64
        $this->contact = $contact;
65
        $this->cellPhone = $cellPhone;
66
        $this->familyLogUuid = $familyLogUuid;
67
        $this->delayDelivery = $delayDelivery;
68
        $this->orderDays = $orderDays;
69
    }
70
71
    public function uuid(): ContactUuid
72
    {
73
        return $this->uuid;
74
    }
75
76
    public function name(): NameField
77
    {
78
        return $this->name;
79
    }
80
81
    public function address(): string
82
    {
83
        return $this->address;
84
    }
85
86
    public function zipCode(): string
87
    {
88
        return $this->zipCode;
89
    }
90
91
    public function town(): string
92
    {
93
        return $this->town;
94
    }
95
96
    public function country(): string
97
    {
98
        return $this->country;
99
    }
100
101
    public function phone(): PhoneField
102
    {
103
        return $this->phone;
104
    }
105
106
    public function facsimile(): PhoneField
107
    {
108
        return $this->facsimile;
109
    }
110
111
    public function email(): EmailField
112
    {
113
        return $this->email;
114
    }
115
116
    public function contact(): string
117
    {
118
        return $this->contact;
119
    }
120
121
    public function cellPhone(): PhoneField
122
    {
123
        return $this->cellPhone;
124
    }
125
126
    public function familyLogUuid(): string
127
    {
128
        return $this->familyLogUuid;
129
    }
130
131
    public function delayDelivery(): int
132
    {
133
        return $this->delayDelivery;
134
    }
135
136
    public function orderDays(): array
137
    {
138
        return $this->orderDays;
139
    }
140
}
141