Passed
Push — develop ( 6aee1f...577144 )
by Laurent
01:44
created

CreateSupplier::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 28
Code Lines 13

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 13
nc 1
nop 13
dl 0
loc 28
rs 9.8333
c 1
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
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\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 CreateSupplier implements CommandProtocol
23
{
24
    private NameField $companyName;
25
    private string $address;
26
    private string $zipCode;
27
    private string $town;
28
    private string $country;
29
    private PhoneField $phone;
30
    private PhoneField $facsimile;
31
    private EmailField $email;
32
    private string $contact;
33
    private PhoneField $cellPhone;
34
    private FamilyLog $familyLog;
35
    private int $delayDelivery;
36
    private array $orderDays;
37
38
    public function __construct(
39
        NameField $companyName,
40
        string $address,
41
        string $zipCode,
42
        string $town,
43
        string $country,
44
        PhoneField $phone,
45
        PhoneField $facsimile,
46
        EmailField $email,
47
        string $contact,
48
        PhoneField $cellPhone,
49
        FamilyLog $familyLog,
50
        int $delayDelivery,
51
        array $orderDays
52
    ) {
53
        $this->companyName = $companyName;
54
        $this->address = $address;
55
        $this->zipCode = $zipCode;
56
        $this->town = $town;
57
        $this->country = $country;
58
        $this->phone = $phone;
59
        $this->facsimile = $facsimile;
60
        $this->email = $email;
61
        $this->contact = $contact;
62
        $this->cellPhone = $cellPhone;
63
        $this->familyLog = $familyLog;
64
        $this->delayDelivery = $delayDelivery;
65
        $this->orderDays = $orderDays;
66
    }
67
68
    public function companyName(): NameField
69
    {
70
        return $this->companyName;
71
    }
72
73
    public function address(): string
74
    {
75
        return $this->address;
76
    }
77
78
    public function zipCode(): string
79
    {
80
        return $this->zipCode;
81
    }
82
83
    public function town(): string
84
    {
85
        return $this->town;
86
    }
87
88
    public function country(): string
89
    {
90
        return $this->country;
91
    }
92
93
    public function phone(): PhoneField
94
    {
95
        return $this->phone;
96
    }
97
98
    public function facsimile(): PhoneField
99
    {
100
        return $this->facsimile;
101
    }
102
103
    public function email(): EmailField
104
    {
105
        return $this->email;
106
    }
107
108
    public function contact(): string
109
    {
110
        return $this->contact;
111
    }
112
113
    public function cellPhone(): PhoneField
114
    {
115
        return $this->cellPhone;
116
    }
117
118
    public function familyLog(): FamilyLog
119
    {
120
        return $this->familyLog;
121
    }
122
123
    public function delayDelivery(): int
124
    {
125
        return $this->delayDelivery;
126
    }
127
128
    public function orderDays(): array
129
    {
130
        return $this->orderDays;
131
    }
132
}
133