Passed
Push — develop ( 229fa6...7d2e81 )
by Laurent
08:00 queued 04:20
created

EditCompany::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 25
Code Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 12
c 1
b 0
f 0
nc 1
nop 11
dl 0
loc 25
rs 9.8666

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 Domain\Administration\Company\Command;
15
16
use Domain\Common\Model\ContactUuid;
17
use Domain\Common\Model\VO\EmailField;
18
use Domain\Common\Model\VO\NameField;
19
use Domain\Common\Model\VO\PhoneField;
20
21
final class EditCompany extends AbstractCompanyCommand
22
{
23
    private string $uuid;
24
25
    public function __construct(
26
        ContactUuid $uuid,
27
        NameField $name,
28
        string $address,
29
        string $zipCode,
30
        string $town,
31
        string $country,
32
        PhoneField $phone,
33
        PhoneField $facsimile,
34
        EmailField $email,
35
        string $contact,
36
        PhoneField $cellPhone
37
    ) {
38
        $this->uuid = $uuid->toString();
39
        parent::__construct(
40
            $name,
41
            $address,
42
            $zipCode,
43
            $town,
44
            $country,
45
            $phone,
46
            $facsimile,
47
            $email,
48
            $contact,
49
            $cellPhone
50
        );
51
    }
52
53
    public function uuid(): string
54
    {
55
        return $this->uuid;
56
    }
57
}
58