Completed
Push — feature/configure_company ( 4609f0 )
by Laurent
08:28
created

Company   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 0
dl 0
loc 33
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A create() 0 24 1
A renameCompany() 0 5 1
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\Model;
15
16
use Domain\Common\Model\Contact;
17
use Domain\Common\Model\ContactUuid;
18
use Domain\Common\Model\VO\ContactAddress;
19
use Domain\Common\Model\VO\EmailField;
20
use Domain\Common\Model\VO\NameField;
21
use Domain\Common\Model\VO\PhoneField;
22
23
class Company extends Contact
24
{
25
    public static function create(
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 $gsm
37
    ): self {
38
        return new self(
39
            $uuid,
40
            $name,
41
            ContactAddress::fromString($address, $zipCode, $town, $country),
42
            $phone,
43
            $facsimile,
44
            $email,
45
            $contact,
46
            $gsm
47
        );
48
    }
49
50
    final public function renameCompany(NameField $name): void
51
    {
52
        $this->name = $name->getValue();
53
        $this->slug = $name->slugify();
54
    }
55
}
56