|
1
|
|
|
<?php |
|
2
|
|
|
namespace mikemix\Wiziq\Entity; |
|
3
|
|
|
|
|
4
|
|
|
class Teacher |
|
5
|
|
|
{ |
|
6
|
|
|
/** @var string */ |
|
7
|
|
|
private $name; |
|
8
|
|
|
|
|
9
|
|
|
/** @var string */ |
|
10
|
|
|
private $email; |
|
11
|
|
|
|
|
12
|
|
|
/** @var string */ |
|
13
|
|
|
private $password; |
|
14
|
|
|
|
|
15
|
|
|
/** @var string */ |
|
16
|
|
|
private $image = ''; |
|
17
|
|
|
|
|
18
|
|
|
/** @var string */ |
|
19
|
|
|
private $phoneNumber = ''; |
|
20
|
|
|
|
|
21
|
|
|
/** @var string */ |
|
22
|
|
|
private $mobileNumber = ''; |
|
23
|
|
|
|
|
24
|
|
|
/** @var string */ |
|
25
|
|
|
private $timeZone = ''; |
|
26
|
|
|
|
|
27
|
|
|
/** @var string */ |
|
28
|
|
|
private $about = ''; |
|
29
|
|
|
|
|
30
|
|
|
/** @var int */ |
|
31
|
|
|
private $canScheduleClass = 0; |
|
32
|
|
|
|
|
33
|
|
|
/** @var int */ |
|
34
|
|
|
private $isActive = 1; |
|
35
|
|
|
|
|
36
|
|
|
|
|
37
|
14 |
|
public function __construct($name, $email, $password) |
|
38
|
|
|
{ |
|
39
|
14 |
|
$this->name = (string)$name; |
|
40
|
14 |
|
$this->email = (string)$email; |
|
41
|
14 |
|
$this->password = (string)$password; |
|
42
|
14 |
|
} |
|
43
|
|
|
|
|
44
|
|
|
/** |
|
45
|
|
|
* @param string $name |
|
46
|
|
|
* @param string $email |
|
47
|
|
|
* @param string $password |
|
48
|
|
|
* @return Teacher |
|
49
|
|
|
*/ |
|
50
|
8 |
|
public static function build($name, $email, $password) |
|
51
|
|
|
{ |
|
52
|
8 |
|
return new self($name, $email, $password); |
|
53
|
|
|
} |
|
54
|
|
|
|
|
55
|
|
|
/** |
|
56
|
|
|
* @return string |
|
57
|
|
|
*/ |
|
58
|
|
|
public function __toString() |
|
59
|
|
|
{ |
|
60
|
|
|
return sprintf('%s (%s)', $this->name, $this->email); |
|
61
|
|
|
} |
|
62
|
|
|
|
|
63
|
|
|
/** |
|
64
|
|
|
* @param string $image |
|
65
|
|
|
* @return self |
|
66
|
|
|
*/ |
|
67
|
1 |
|
public function withImage($image) |
|
68
|
|
|
{ |
|
69
|
1 |
|
$self = clone $this; |
|
70
|
1 |
|
$self->image = (string)$image; |
|
71
|
|
|
|
|
72
|
1 |
|
return $self; |
|
73
|
|
|
} |
|
74
|
|
|
|
|
75
|
|
|
/** |
|
76
|
|
|
* @param string $phoneNumber |
|
77
|
|
|
* @return self |
|
78
|
|
|
*/ |
|
79
|
1 |
|
public function withPhoneNumber($phoneNumber) |
|
80
|
|
|
{ |
|
81
|
1 |
|
$self = clone $this; |
|
82
|
1 |
|
$self->phoneNumber = (string)$phoneNumber; |
|
83
|
|
|
|
|
84
|
1 |
|
return $self; |
|
85
|
|
|
} |
|
86
|
|
|
|
|
87
|
|
|
/** |
|
88
|
|
|
* @param string $mobileNumber |
|
89
|
|
|
* @return self |
|
90
|
|
|
*/ |
|
91
|
1 |
|
public function withMobileNumber($mobileNumber) |
|
92
|
|
|
{ |
|
93
|
1 |
|
$self = clone $this; |
|
94
|
1 |
|
$self->mobileNumber = (string)$mobileNumber; |
|
95
|
|
|
|
|
96
|
1 |
|
return $self; |
|
97
|
|
|
} |
|
98
|
|
|
|
|
99
|
|
|
/** |
|
100
|
|
|
* @param string $timeZone |
|
101
|
|
|
* @return self |
|
102
|
|
|
*/ |
|
103
|
1 |
|
public function withTimeZone($timeZone) |
|
104
|
|
|
{ |
|
105
|
1 |
|
$self = clone $this; |
|
106
|
1 |
|
$self->timeZone = (string)$timeZone; |
|
107
|
|
|
|
|
108
|
1 |
|
return $self; |
|
109
|
|
|
} |
|
110
|
|
|
|
|
111
|
|
|
/** |
|
112
|
|
|
* @param string $about |
|
113
|
|
|
* @return self |
|
114
|
|
|
*/ |
|
115
|
1 |
|
public function withAbout($about) |
|
116
|
|
|
{ |
|
117
|
1 |
|
$self = clone $this; |
|
118
|
1 |
|
$self->about = (string)$about; |
|
119
|
|
|
|
|
120
|
1 |
|
return $self; |
|
121
|
|
|
} |
|
122
|
|
|
|
|
123
|
|
|
/** |
|
124
|
|
|
* @param string $canScheduleClass |
|
125
|
|
|
* @return self |
|
126
|
|
|
*/ |
|
127
|
1 |
|
public function withCanScheduleClass($canScheduleClass) |
|
128
|
|
|
{ |
|
129
|
1 |
|
$self = clone $this; |
|
130
|
1 |
|
$self->canScheduleClass = (int)(bool)$canScheduleClass; |
|
131
|
|
|
|
|
132
|
1 |
|
return $self; |
|
133
|
|
|
} |
|
134
|
|
|
|
|
135
|
|
|
/** |
|
136
|
|
|
* @param string $isActive |
|
137
|
|
|
* @return self |
|
138
|
|
|
*/ |
|
139
|
1 |
|
public function withIsActive($isActive) |
|
140
|
|
|
{ |
|
141
|
1 |
|
$self = clone $this; |
|
142
|
1 |
|
$self->isActive = (int)(bool)$isActive; |
|
143
|
|
|
|
|
144
|
1 |
|
return $self; |
|
145
|
|
|
} |
|
146
|
|
|
|
|
147
|
10 |
|
public function toArray() |
|
148
|
|
|
{ |
|
149
|
|
|
return [ |
|
150
|
10 |
|
'name' => $this->name, |
|
151
|
10 |
|
'email' => $this->email, |
|
152
|
10 |
|
'password' => $this->password, |
|
153
|
10 |
|
'image' => $this->image, |
|
154
|
10 |
|
'phone_number' => $this->phoneNumber, |
|
155
|
10 |
|
'mobile_number' => $this->mobileNumber, |
|
156
|
10 |
|
'time_zone' => $this->timeZone, |
|
157
|
10 |
|
'about_the_teacher' => $this->about, |
|
158
|
10 |
|
'can_schedule_class' => $this->canScheduleClass, |
|
159
|
10 |
|
'is_active' => $this->isActive, |
|
160
|
10 |
|
]; |
|
161
|
|
|
} |
|
162
|
|
|
} |
|
163
|
|
|
|