1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* WebHemi. |
4
|
|
|
* |
5
|
|
|
* PHP version 7.2 |
6
|
|
|
* |
7
|
|
|
* @copyright 2012 - 2019 Gixx-web (http://www.gixx-web.com) |
8
|
|
|
* @license https://opensource.org/licenses/MIT The MIT License (MIT) |
9
|
|
|
* |
10
|
|
|
* @link http://www.gixx-web.com |
11
|
|
|
*/ |
12
|
|
|
declare(strict_types = 1); |
13
|
|
|
|
14
|
|
|
namespace WebHemi\Data\Entity; |
15
|
|
|
|
16
|
|
|
use WebHemi\DateTime; |
17
|
|
|
|
18
|
|
|
/** |
19
|
|
|
* Class DomainEntity |
20
|
|
|
*/ |
21
|
|
|
class DomainEntity extends AbstractEntity |
22
|
|
|
{ |
23
|
|
|
/** |
24
|
|
|
* DomainEntity constructor. |
25
|
|
|
*/ |
26
|
|
|
public function __construct() |
27
|
|
|
{ |
28
|
|
|
$this->container = [ |
29
|
|
|
'id_domain' => null, |
30
|
|
|
'schema' => null, |
31
|
|
|
'domain' => null, |
32
|
|
|
'title' => null, |
33
|
|
|
'is_default' => null, |
34
|
|
|
'is_read_only' => null, |
35
|
|
|
'date_created' => null, |
36
|
|
|
'date_modified' => null |
37
|
|
|
]; |
38
|
|
|
} |
39
|
|
|
|
40
|
|
|
/** |
41
|
|
|
* @param int $identifier |
42
|
|
|
* @return DomainEntity |
43
|
|
|
*/ |
44
|
|
|
public function setDomainId(int $identifier) : DomainEntity |
45
|
|
|
{ |
46
|
|
|
$this->container['id_domain'] = $identifier; |
47
|
|
|
|
48
|
|
|
return $this; |
49
|
|
|
} |
50
|
|
|
|
51
|
|
|
/** |
52
|
|
|
* @return int|null |
53
|
|
|
*/ |
54
|
|
|
public function getDomainId() : ? int |
55
|
|
|
{ |
56
|
|
|
return $this->container['id_domain'] !== null |
57
|
|
|
? (int) $this->container['id_domain'] |
58
|
|
|
: null; |
59
|
|
|
} |
60
|
|
|
|
61
|
|
|
/** |
62
|
|
|
* @param string $schema |
63
|
|
|
* @return DomainEntity |
64
|
|
|
*/ |
65
|
|
|
public function setSchema(string $schema) : DomainEntity |
66
|
|
|
{ |
67
|
|
|
$this->container['schema'] = $schema; |
68
|
|
|
|
69
|
|
|
return $this; |
70
|
|
|
} |
71
|
|
|
|
72
|
|
|
/** |
73
|
|
|
* @return null|string |
74
|
|
|
*/ |
75
|
|
|
public function getSchema() : ? string |
76
|
|
|
{ |
77
|
|
|
return $this->container['schema']; |
78
|
|
|
} |
79
|
|
|
|
80
|
|
|
/** |
81
|
|
|
* @param string $domain |
82
|
|
|
* @return DomainEntity |
83
|
|
|
*/ |
84
|
|
|
public function setDomain(string $domain) : DomainEntity |
85
|
|
|
{ |
86
|
|
|
$this->container['domain'] = $domain; |
87
|
|
|
|
88
|
|
|
return $this; |
89
|
|
|
} |
90
|
|
|
|
91
|
|
|
/** |
92
|
|
|
* @return null|string |
93
|
|
|
*/ |
94
|
|
|
public function getDomain() : ? string |
95
|
|
|
{ |
96
|
|
|
return $this->container['domain']; |
97
|
|
|
} |
98
|
|
|
|
99
|
|
|
/** |
100
|
|
|
* @param string $title |
101
|
|
|
* @return DomainEntity |
102
|
|
|
*/ |
103
|
|
|
public function setTitle(string $title) : DomainEntity |
104
|
|
|
{ |
105
|
|
|
$this->container['title'] = $title; |
106
|
|
|
|
107
|
|
|
return $this; |
108
|
|
|
} |
109
|
|
|
|
110
|
|
|
/** |
111
|
|
|
* @return null|string |
112
|
|
|
*/ |
113
|
|
|
public function getTitle() : ? string |
114
|
|
|
{ |
115
|
|
|
return $this->container['title']; |
116
|
|
|
} |
117
|
|
|
|
118
|
|
|
/** |
119
|
|
|
* @param bool $isDefault |
120
|
|
|
* @return DomainEntity |
121
|
|
|
*/ |
122
|
|
|
public function setIsDefault(bool $isDefault) : DomainEntity |
123
|
|
|
{ |
124
|
|
|
$this->container['is_default'] = $isDefault ? 1 : 0; |
125
|
|
|
|
126
|
|
|
return $this; |
127
|
|
|
} |
128
|
|
|
|
129
|
|
|
/** |
130
|
|
|
* @return bool |
131
|
|
|
*/ |
132
|
|
|
public function getIsDefault() : bool |
133
|
|
|
{ |
134
|
|
|
return !empty($this->container['is_default']); |
135
|
|
|
} |
136
|
|
|
|
137
|
|
|
/** |
138
|
|
|
* @param bool $isReadonly |
139
|
|
|
* @return DomainEntity |
140
|
|
|
*/ |
141
|
|
|
public function setIsReadOnly(bool $isReadonly) : DomainEntity |
142
|
|
|
{ |
143
|
|
|
$this->container['is_read_only'] = $isReadonly ? 1 : 0; |
144
|
|
|
|
145
|
|
|
return $this; |
146
|
|
|
} |
147
|
|
|
|
148
|
|
|
/** |
149
|
|
|
* @return bool |
150
|
|
|
*/ |
151
|
|
|
public function getIsReadOnly() : bool |
152
|
|
|
{ |
153
|
|
|
return !empty($this->container['is_read_only']); |
154
|
|
|
} |
155
|
|
|
|
156
|
|
|
/** |
157
|
|
|
* @param DateTime $dateTime |
158
|
|
|
* @return DomainEntity |
159
|
|
|
*/ |
160
|
|
|
public function setDateCreated(DateTime $dateTime) : DomainEntity |
161
|
|
|
{ |
162
|
|
|
$this->container['date_created'] = $dateTime->format('Y-m-d H:i:s'); |
163
|
|
|
|
164
|
|
|
return $this; |
165
|
|
|
} |
166
|
|
|
|
167
|
|
|
/** |
168
|
|
|
* @return null|DateTime |
169
|
|
|
*/ |
170
|
|
|
public function getDateCreated() : ? DateTime |
171
|
|
|
{ |
172
|
|
|
return !empty($this->container['date_created']) |
173
|
|
|
? new DateTime($this->container['date_created']) |
174
|
|
|
: null; |
175
|
|
|
} |
176
|
|
|
|
177
|
|
|
/** |
178
|
|
|
* @param DateTime $dateTime |
179
|
|
|
* @return DomainEntity |
180
|
|
|
*/ |
181
|
|
|
public function setDateModified(DateTime $dateTime) : DomainEntity |
182
|
|
|
{ |
183
|
|
|
$this->container['date_modified'] = $dateTime->format('Y-m-d H:i:s'); |
184
|
|
|
|
185
|
|
|
return $this; |
186
|
|
|
} |
187
|
|
|
|
188
|
|
|
/** |
189
|
|
|
* @return null|DateTime |
190
|
|
|
*/ |
191
|
|
|
public function getDateModified() : ? DateTime |
192
|
|
|
{ |
193
|
|
|
return !empty($this->container['date_modified']) |
194
|
|
|
? new DateTime($this->container['date_modified']) |
195
|
|
|
: null; |
196
|
|
|
} |
197
|
|
|
} |
198
|
|
|
|