Passed
Push — feature/configure_company ( 5f97ab...38f251 )
by Laurent
03:30 queued 10s
created

Contact::changeFacsimileNumber()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
c 0
b 0
f 0
rs 10
cc 1
nc 1
nop 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\Common\Model;
15
16
use Domain\Common\Model\VO\ContactAddress;
17
use Domain\Common\Model\VO\EmailField;
18
use Domain\Common\Model\VO\NameField;
19
use Domain\Common\Model\VO\PhoneField;
20
21
abstract class Contact
22
{
23
    protected string $uuid;
24
    protected string $name;
25
    protected string $address;
26
    protected string $phone;
27
    protected string $facsimile;
28
    protected string $email;
29
    protected string $contact;
30
    protected string $cellphone;
31
    protected string $slug;
32
33
    public function __construct(
34
        ContactUuid $uuid,
35
        NameField $name,
36
        ContactAddress $address,
37
        PhoneField $phone,
38
        PhoneField $facsimile,
39
        EmailField $email,
40
        string $contact,
41
        PhoneField $cellphone
42
    ) {
43
        $this->uuid = $uuid->toString();
44
        $this->name = $name->getValue();
45
        $this->slug = $name->slugify();
46
        $this->address = $address->getValue();
47
        $this->phone = $phone->getValue();
48
        $this->facsimile = $facsimile->getValue();
49
        $this->email = $email->getValue();
50
        $this->contact = $contact;
51
        $this->cellphone = $cellphone->getValue();
52
    }
53
54
    final public function uuid(): string
55
    {
56
        return $this->uuid;
57
    }
58
59
    final public function name(): string
60
    {
61
        return $this->name;
62
    }
63
64
    final public function renameContact(NameField $name): void
65
    {
66
        $this->name = $name->getValue();
67
        $this->slug = $name->slugify();
68
    }
69
70
    final public function address(): string
71
    {
72
        return $this->address;
73
    }
74
75
    final public function rewriteAddress(array $addressData): void
76
    {
77
        $address = ContactAddress::fromArray($addressData);
78
        $this->address = $address->getValue();
79
    }
80
81
    final public function phone(): string
82
    {
83
        return $this->phone;
84
    }
85
86
    final public function changePhoneNumber(string $phone): void
87
    {
88
        $this->phone = $phone;
89
    }
90
91
    final public function facsimile(): string
92
    {
93
        return $this->facsimile;
94
    }
95
96
    final public function changeFacsimileNumber(string $facsimile): void
97
    {
98
        $this->facsimile = $facsimile;
99
    }
100
101
    final public function email(): string
102
    {
103
        return $this->email;
104
    }
105
106
    final public function rewriteEmail(EmailField $email): void
107
    {
108
        $this->email = $email->getValue();
109
    }
110
111
    final public function contact(): string
112
    {
113
        return $this->contact;
114
    }
115
116
    final public function setContact(string $contact): void
117
    {
118
        $this->contact = $contact;
119
    }
120
121
    final public function cellphone(): string
122
    {
123
        return $this->cellphone;
124
    }
125
126
    final public function changeCellphoneNumber(string $cellphone): void
127
    {
128
        $this->cellphone = $cellphone;
129
    }
130
131
    final public function slug(): string
132
    {
133
        return $this->slug;
134
    }
135
}
136