|
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->address = $address->getValue(); |
|
46
|
|
|
$this->phone = $phone->getValue(); |
|
47
|
|
|
$this->facsimile = $facsimile->getValue(); |
|
48
|
|
|
$this->email = $email->getValue(); |
|
49
|
|
|
$this->contact = $contact; |
|
50
|
|
|
$this->cellphone = $cellphone->getValue(); |
|
51
|
|
|
} |
|
52
|
|
|
|
|
53
|
|
|
final public function name(): string |
|
54
|
|
|
{ |
|
55
|
|
|
return $this->name; |
|
56
|
|
|
} |
|
57
|
|
|
|
|
58
|
|
|
final public function renameContact(NameField $name): void |
|
59
|
|
|
{ |
|
60
|
|
|
$this->name = $name->getValue(); |
|
61
|
|
|
$this->slug = $name->slugify(); |
|
62
|
|
|
} |
|
63
|
|
|
|
|
64
|
|
|
final public function address(): string |
|
65
|
|
|
{ |
|
66
|
|
|
return $this->address; |
|
67
|
|
|
} |
|
68
|
|
|
|
|
69
|
|
|
final public function rewriteAddress(ContactAddress $address): void |
|
70
|
|
|
{ |
|
71
|
|
|
$this->address = $address->getValue(); |
|
72
|
|
|
} |
|
73
|
|
|
|
|
74
|
|
|
final public function phone(): string |
|
75
|
|
|
{ |
|
76
|
|
|
return $this->phone; |
|
77
|
|
|
} |
|
78
|
|
|
|
|
79
|
|
|
final public function changePhoneNumber(string $phone): void |
|
80
|
|
|
{ |
|
81
|
|
|
$this->phone = $phone; |
|
82
|
|
|
} |
|
83
|
|
|
|
|
84
|
|
|
final public function facsimile(): string |
|
85
|
|
|
{ |
|
86
|
|
|
return $this->facsimile; |
|
87
|
|
|
} |
|
88
|
|
|
|
|
89
|
|
|
final public function changeFacsimileNumber(string $facsimile): void |
|
90
|
|
|
{ |
|
91
|
|
|
$this->facsimile = $facsimile; |
|
92
|
|
|
} |
|
93
|
|
|
|
|
94
|
|
|
final public function email(): string |
|
95
|
|
|
{ |
|
96
|
|
|
return $this->email; |
|
97
|
|
|
} |
|
98
|
|
|
|
|
99
|
|
|
final public function rewriteEmail(EmailField $email): void |
|
100
|
|
|
{ |
|
101
|
|
|
$this->email = $email->getValue(); |
|
102
|
|
|
} |
|
103
|
|
|
|
|
104
|
|
|
final public function contact(): string |
|
105
|
|
|
{ |
|
106
|
|
|
return $this->contact; |
|
107
|
|
|
} |
|
108
|
|
|
|
|
109
|
|
|
final public function setContact(string $contact): void |
|
110
|
|
|
{ |
|
111
|
|
|
$this->contact = $contact; |
|
112
|
|
|
} |
|
113
|
|
|
|
|
114
|
|
|
final public function cellphone(): string |
|
115
|
|
|
{ |
|
116
|
|
|
return $this->cellphone; |
|
117
|
|
|
} |
|
118
|
|
|
|
|
119
|
|
|
final public function changeCellphoneNumber(string $cellphone): void |
|
120
|
|
|
{ |
|
121
|
|
|
$this->cellphone = $cellphone; |
|
122
|
|
|
} |
|
123
|
|
|
|
|
124
|
|
|
final public function slug(): string |
|
125
|
|
|
{ |
|
126
|
|
|
return $this->slug; |
|
127
|
|
|
} |
|
128
|
|
|
} |
|
129
|
|
|
|