Passed
Push — master ( a157fa...3bdbe0 )
by Gabor
02:36
created

ApplicationEntity::getDomain()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * WebHemi.
4
 *
5
 * PHP version 7.1
6
 *
7
 * @copyright 2012 - 2018 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 DateTimeZone;
17
use WebHemi\DateTime;
18
19
/**
20
 * Class AbstractEntity
21
 */
22
class ApplicationEntity extends AbstractEntity
23
{
24
    /**
25
     * @var array
26
     */
27
    protected $container = [
28
        'id_application' => null,
29
        'name' => null,
30
        'title' => null,
31
        'introduction' => null,
32
        'subject' => null,
33
        'description' => null,
34
        'keywords' => null,
35
        'copyright' => null,
36
        'domain' => null,
37
        'path' => null,
38
        'theme' => null,
39
        'type' => null,
40
        'locale' => null,
41
        'timezone' => null,
42
        'is_read_only' => null,
43
        'is_enabled' => null,
44
        'date_created' => null,
45
        'date_modified' => null,
46
    ];
47
48
    /**
49
     * @param int $identifier
50
     * @return ApplicationEntity
51
     */
52 8
    public function setApplicationId(int $identifier) : ApplicationEntity
53
    {
54 8
        $this->container['id_application'] = $identifier;
55
56 8
        return $this;
57
    }
58
59
    /**
60
     * @return int|null
61
     */
62 2
    public function getApplicationId() : ? int
63
    {
64 2
        return !is_null($this->container['id_application'])
65 2
            ? (int) $this->container['id_application']
66 2
            : null;
67
    }
68
69
    /**
70
     * @param string $name
71
     * @return ApplicationEntity
72
     */
73 2
    public function setName(string $name) : ApplicationEntity
74
    {
75 2
        $this->container['name'] = $name;
76
77 2
        return $this;
78
    }
79
80
    /**
81
     * @return null|string
82
     */
83 1
    public function getName() : ? string
84
    {
85 1
        return $this->container['name'];
86
    }
87
88
    /**
89
     * @param string $title
90
     * @return ApplicationEntity
91
     */
92 1
    public function setTitle(string $title) : ApplicationEntity
93
    {
94 1
        $this->container['title'] = $title;
95
96 1
        return $this;
97
    }
98
99
    /**
100
     * @return null|string
101
     */
102 1
    public function getTitle() : ? string
103
    {
104 1
        return $this->container['title'];
105
    }
106
107
    /**
108
     * @param string $introduction
109
     * @return ApplicationEntity
110
     */
111 1
    public function setIntroduction(string $introduction) : ApplicationEntity
112
    {
113 1
        $this->container['introduction'] = $introduction;
114
115 1
        return $this;
116
    }
117
118
    /**
119
     * @return null|string
120
     */
121 1
    public function getIntroduction() : ? string
122
    {
123 1
        return $this->container['introduction'];
124
    }
125
126
    /**
127
     * @param string $subject
128
     * @return ApplicationEntity
129
     */
130 1
    public function setSubject(string $subject) : ApplicationEntity
131
    {
132 1
        $this->container['subject'] = $subject;
133
134 1
        return $this;
135
    }
136
137
    /**
138
     * @return null|string
139
     */
140 1
    public function getSubject() : ? string
141
    {
142 1
        return $this->container['subject'];
143
    }
144
145
    /**
146
     * @param string $description
147
     * @return ApplicationEntity
148
     */
149 1
    public function setDescription(string $description) : ApplicationEntity
150
    {
151 1
        $this->container['description'] = $description;
152
153 1
        return $this;
154
    }
155
156
    /**
157
     * @return null|string
158
     */
159 1
    public function getDescription() : ? string
160
    {
161 1
        return $this->container['description'];
162
    }
163
164
    /**
165
     * @param string $keywords
166
     * @return ApplicationEntity
167
     */
168 1
    public function setKeywords(string $keywords) : ApplicationEntity
169
    {
170 1
        $this->container['keywords'] = $keywords;
171
172 1
        return $this;
173
    }
174
175
    /**
176
     * @return null|string
177
     */
178 1
    public function getKeywords() : ? string
179
    {
180 1
        return $this->container['keywords'];
181
    }
182
183
    /**
184
     * @param string $copyright
185
     * @return ApplicationEntity
186
     */
187 1
    public function setCopyright(string $copyright) : ApplicationEntity
188
    {
189 1
        $this->container['copyright'] = $copyright;
190
191 1
        return $this;
192
    }
193
194
    /**
195
     * @return null|string
196
     */
197 1
    public function getCopyright() : ? string
198
    {
199 1
        return $this->container['copyright'];
200
    }
201
202
    /**
203
     * @param string $domain
204
     * @return ApplicationEntity
205
     */
206 1
    public function setDomain(string $domain) : ApplicationEntity
207
    {
208 1
        $this->container['domain'] = $domain;
209
210 1
        return $this;
211
    }
212
213
    /**
214
     * @return null|string
215
     */
216 1
    public function getDomain() : ? string
217
    {
218 1
        return $this->container['domain'];
219
    }
220
221
    /**
222
     * @param string $path
223
     * @return ApplicationEntity
224
     */
225 1
    public function setPath(string $path) : ApplicationEntity
226
    {
227 1
        $this->container['path'] = $path;
228
229 1
        return $this;
230
    }
231
232
    /**
233
     * @return null|string
234
     */
235 1
    public function getPath() : ? string
236
    {
237 1
        return $this->container['path'];
238
    }
239
240
    /**
241
     * @param string $theme
242
     * @return ApplicationEntity
243
     */
244 1
    public function setTheme(string $theme) : ApplicationEntity
245
    {
246 1
        $this->container['theme'] = $theme;
247
248 1
        return $this;
249
    }
250
251
    /**
252
     * @return null|string
253
     */
254 1
    public function getTheme() : ? string
255
    {
256 1
        return $this->container['theme'];
257
    }
258
259
    /**
260
     * @param string $type
261
     * @return ApplicationEntity
262
     */
263 1
    public function setType(string $type) : ApplicationEntity
264
    {
265 1
        $this->container['type'] = $type;
266
267 1
        return $this;
268
    }
269
270
    /**
271
     * @return null|string
272
     */
273 1
    public function getType() : ? string
274
    {
275 1
        return $this->container['type'];
276
    }
277
278
    /**
279
     * @param string $locale
280
     * @return ApplicationEntity
281
     */
282 1
    public function setLocale(string $locale) : ApplicationEntity
283
    {
284 1
        $this->container['locale'] = $locale;
285
286 1
        return $this;
287
    }
288
289
    /**
290
     * @return null|string
291
     */
292 1
    public function getLocale() : ? string
293
    {
294 1
        return $this->container['locale'];
295
    }
296
297
    /**
298
     * @param DateTimeZone $timeZone
299
     * @return ApplicationEntity
300
     */
301 1
    public function setTimeZone(DateTimeZone $timeZone) : ApplicationEntity
302
    {
303 1
        $this->container['timezone'] = $timeZone->getName();
304
305 1
        return $this;
306
    }
307
308
    /**
309
     * @return DateTimeZone|null
310
     */
311 1
    public function getTimeZone() : ? DateTimeZone
312
    {
313 1
        return !empty($this->container['timezone'])
314 1
            ? new DateTimeZone($this->container['timezone'])
315 1
            : null;
316
    }
317
318
    /**
319
     * @param bool $isReadonly
320
     * @return ApplicationEntity
321
     */
322 1
    public function setIsReadOnly(bool $isReadonly) : ApplicationEntity
323
    {
324 1
        $this->container['is_read_only'] = $isReadonly ? 1 : 0;
325
326 1
        return $this;
327
    }
328
329
    /**
330
     * @return bool
331
     */
332 1
    public function getIsReadOnly() : bool
333
    {
334 1
        return !empty($this->container['is_read_only']);
335
    }
336
337
    /**
338
     * @param bool $isEnabled
339
     * @return ApplicationEntity
340
     */
341 1
    public function setIsEnabled(bool $isEnabled) : ApplicationEntity
342
    {
343 1
        $this->container['is_enabled'] = $isEnabled ? 1 : 0;
344
345 1
        return $this;
346
    }
347
348
    /**
349
     * @return bool
350
     */
351 1
    public function getIsEnabled() : bool
352
    {
353 1
        return !empty($this->container['is_enabled']);
354
    }
355
356
    /**
357
     * @param DateTime $dateTime
358
     * @return ApplicationEntity
359
     */
360 1
    public function setDateCreated(DateTime $dateTime) : ApplicationEntity
361
    {
362 1
        $this->container['date_created'] = $dateTime->format('Y-m-d H:i:s');
363
364 1
        return $this;
365
    }
366
367
    /**
368
     * @return null|DateTime
369
     */
370 1
    public function getDateCreated() : ? DateTime
371
    {
372 1
        return !empty($this->container['date_created'])
373 1
            ? new DateTime($this->container['date_created'])
374 1
            : null;
375
    }
376
377
    /**
378
     * @param DateTime $dateTime
379
     * @return ApplicationEntity
380
     */
381 1
    public function setDateModified(DateTime $dateTime) : ApplicationEntity
382
    {
383 1
        $this->container['date_modified'] = $dateTime->format('Y-m-d H:i:s');
384
385 1
        return $this;
386
    }
387
388
    /**
389
     * @return null|DateTime
390
     */
391 2
    public function getDateModified() : ? DateTime
392
    {
393 2
        return !empty($this->container['date_modified'])
394 1
            ? new DateTime($this->container['date_modified'])
395 2
            : null;
396
    }
397
}
398