1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace WeDevBr\Bankly\Inputs; |
4
|
|
|
|
5
|
|
|
use WeDevBr\Bankly\Support\Contracts\CustomerInterface; |
6
|
|
|
|
7
|
|
|
/** |
8
|
|
|
* Customer class |
9
|
|
|
* |
10
|
|
|
* PHP version 7.4|8.0 |
11
|
|
|
* |
12
|
|
|
* @author WeDev Brasil Team <[email protected]> |
13
|
|
|
* @author Rafael Teixeira <[email protected]> |
14
|
|
|
* @copyright 2020 We Dev Tecnologia Ltda |
15
|
|
|
* @link https://github.com/wedevBr/bankly-laravel |
16
|
|
|
*/ |
17
|
|
|
class Customer implements CustomerInterface |
18
|
|
|
{ |
19
|
|
|
/** @var string */ |
20
|
|
|
protected $registerName; |
21
|
|
|
|
22
|
|
|
/** @var string */ |
23
|
|
|
protected $socialName; |
24
|
|
|
|
25
|
|
|
/** @var CustomerPhone */ |
26
|
|
|
protected $phone; |
27
|
|
|
|
28
|
|
|
/** @var CustomerAddress */ |
29
|
|
|
protected $address; |
30
|
|
|
|
31
|
|
|
/** @var string */ |
32
|
|
|
protected $birthDate; |
33
|
|
|
|
34
|
|
|
/** @var string */ |
35
|
|
|
protected $motherName; |
36
|
|
|
|
37
|
|
|
/** @var string */ |
38
|
|
|
protected $email; |
39
|
|
|
|
40
|
|
|
/** |
41
|
|
|
* @param string $name |
42
|
|
|
* @return Customer |
43
|
|
|
*/ |
44
|
|
|
public function setRegisterName(string $name): Customer |
45
|
|
|
{ |
46
|
|
|
$this->registerName = $name; |
47
|
|
|
return $this; |
48
|
|
|
} |
49
|
|
|
|
50
|
|
|
/** |
51
|
|
|
* @param string $name |
52
|
|
|
* @return Customer |
53
|
|
|
*/ |
54
|
|
|
public function setSocialName(string $name): Customer |
55
|
|
|
{ |
56
|
|
|
$this->socialName = $name; |
57
|
|
|
return $this; |
58
|
|
|
} |
59
|
|
|
|
60
|
|
|
public function setPhone(CustomerPhone $phone): Customer |
61
|
|
|
{ |
62
|
|
|
$this->phone = $phone; |
63
|
|
|
return $this; |
64
|
|
|
} |
65
|
|
|
|
66
|
|
|
public function setAddress(CustomerAddress $address): Customer |
67
|
|
|
{ |
68
|
|
|
$this->address = $address; |
69
|
|
|
return $this; |
70
|
|
|
} |
71
|
|
|
|
72
|
|
|
/** |
73
|
|
|
* @param string $birthDate |
74
|
|
|
* @return Customer |
75
|
|
|
*/ |
76
|
|
|
public function setBirthDate(string $birthDate): Customer |
77
|
|
|
{ |
78
|
|
|
$this->birthDate = $birthDate; |
79
|
|
|
return $this; |
80
|
|
|
} |
81
|
|
|
|
82
|
|
|
/** |
83
|
|
|
* @param string $motherName |
84
|
|
|
* @return Customer |
85
|
|
|
*/ |
86
|
|
|
public function setMotherName(string $motherName): Customer |
87
|
|
|
{ |
88
|
|
|
$this->motherName = $motherName; |
89
|
|
|
return $this; |
90
|
|
|
} |
91
|
|
|
|
92
|
|
|
/** |
93
|
|
|
* @param string $email |
94
|
|
|
* @return Customer |
95
|
|
|
*/ |
96
|
|
|
public function setEmail(string $email): Customer |
97
|
|
|
{ |
98
|
|
|
$this->email = $email; |
99
|
|
|
return $this; |
100
|
|
|
} |
101
|
|
|
|
102
|
|
|
/** |
103
|
|
|
* @return string |
104
|
|
|
*/ |
105
|
|
|
public function getRegisterName(): string |
106
|
|
|
{ |
107
|
|
|
return $this->registerName; |
108
|
|
|
} |
109
|
|
|
|
110
|
|
|
/** |
111
|
|
|
* @return string |
112
|
|
|
*/ |
113
|
|
|
public function getSocialName(): string |
114
|
|
|
{ |
115
|
|
|
return $this->socialName; |
116
|
|
|
} |
117
|
|
|
|
118
|
|
|
/** |
119
|
|
|
* @return CustomerPhone |
120
|
|
|
*/ |
121
|
|
|
public function getPhone(): CustomerPhone |
122
|
|
|
{ |
123
|
|
|
return $this->phone; |
124
|
|
|
} |
125
|
|
|
|
126
|
|
|
/** |
127
|
|
|
* @return CustomerAddress |
128
|
|
|
*/ |
129
|
|
|
public function getAddress(): CustomerAddress |
130
|
|
|
{ |
131
|
|
|
return $this->address; |
132
|
|
|
} |
133
|
|
|
|
134
|
|
|
/** |
135
|
|
|
* @return string |
136
|
|
|
*/ |
137
|
|
|
public function getBirthDate(): string |
138
|
|
|
{ |
139
|
|
|
return $this->birthDate; |
140
|
|
|
} |
141
|
|
|
|
142
|
|
|
public function getMotherName(): string |
143
|
|
|
{ |
144
|
|
|
return $this->motherName; |
145
|
|
|
} |
146
|
|
|
|
147
|
|
|
/** |
148
|
|
|
* @return string |
149
|
|
|
*/ |
150
|
|
|
public function getEmail(): string |
151
|
|
|
{ |
152
|
|
|
return $this->email; |
153
|
|
|
} |
154
|
|
|
|
155
|
|
|
/** |
156
|
|
|
* @return array |
157
|
|
|
*/ |
158
|
|
|
public function toArray(): array |
159
|
|
|
{ |
160
|
|
|
return [ |
161
|
|
|
'phone' => $this->phone->toArray(), |
162
|
|
|
'address' => $this->address->toArray(), |
163
|
|
|
'socialName' => $this->socialName, |
164
|
|
|
'registerName' => $this->registerName, |
165
|
|
|
'birthDate' => $this->birthDate, |
166
|
|
|
'motherName' => $this->motherName, |
167
|
|
|
'email' => $this->email, |
168
|
|
|
]; |
169
|
|
|
} |
170
|
|
|
} |
171
|
|
|
|