Passed
Push — develop ( 7d2e81...61e6f0 )
by Laurent
06:22 queued 03:53
created

Company   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 15
dl 0
loc 34
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A renameCompany() 0 4 1
A create() 0 25 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 Administration\Domain\Company\Model;
15
16
use Core\Domain\Common\Model\Contact;
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
22
class Company extends Contact
23
{
24
    public static function create(
25
        ContactUuid $uuid,
26
        NameField $name,
27
        string $address,
28
        string $zipCode,
29
        string $town,
30
        string $country,
31
        PhoneField $phone,
32
        PhoneField $facsimile,
33
        EmailField $email,
34
        string $contact,
35
        PhoneField $gsm
36
    ): self {
37
        return new self(
38
            $uuid,
39
            $name,
40
            $address,
41
            $zipCode,
42
            $town,
43
            $country,
44
            $phone,
45
            $facsimile,
46
            $email,
47
            $contact,
48
            $gsm
49
        );
50
    }
51
52
    final public function renameCompany(NameField $name): void
53
    {
54
        $this->name = $name->getValue();
55
        $this->slug = $name->slugify();
56
    }
57
}
58