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

UserGroupEntity   A

Complexity

Total Complexity 18

Size/Duplication

Total Lines 153
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
eloc 37
dl 0
loc 153
ccs 0
cts 68
cp 0
rs 10
c 0
b 0
f 0
wmc 18

14 Methods

Rating   Name   Duplication   Size   Complexity  
A setName() 0 5 1
A setTitle() 0 5 1
A setDateCreated() 0 5 1
A getUserGroupId() 0 5 2
A getTitle() 0 3 1
A getName() 0 3 1
A getDateCreated() 0 5 2
A setUserGroupId() 0 5 1
A getDescription() 0 3 1
A getDateModified() 0 5 2
A setIsReadOnly() 0 5 2
A getIsReadOnly() 0 3 1
A setDateModified() 0 5 1
A setDescription() 0 5 1
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 WebHemi\DateTime;
17
18
/**
19
 * Class UserGroupEntity
20
 */
21
class UserGroupEntity extends AbstractEntity
22
{
23
    /**
24
     * @var array
25
     */
26
    protected $container = [
27
        'id_user_group' => null,
28
        'name' => null,
29
        'title' => null,
30
        'introduction' => null,
31
        'description' => null,
32
        'is_read_only' => null,
33
        'date_created' => null,
34
        'date_modified' => null,
35
    ];
36
37
    /**
38
     * @param int $identifier
39
     * @return UserGroupEntity
40
     */
41
    public function setUserGroupId(int $identifier) : UserGroupEntity
42
    {
43
        $this->container['id_user_group'] = $identifier;
44
45
        return $this;
46
    }
47
48
    /**
49
     * @return int|null
50
     */
51
    public function getUserGroupId() : ? int
52
    {
53
        return !is_null($this->container['id_user_group'])
54
            ? (int) $this->container['id_user_group']
55
            : null;
56
    }
57
58
    /**
59
     * @param string $name
60
     * @return UserGroupEntity
61
     */
62
    public function setName(string $name) : UserGroupEntity
63
    {
64
        $this->container['name'] = $name;
65
66
        return $this;
67
    }
68
69
    /**
70
     * @return null|string
71
     */
72
    public function getName() : ? string
73
    {
74
        return $this->container['name'];
75
    }
76
77
    /**
78
     * @param string $title
79
     * @return UserGroupEntity
80
     */
81
    public function setTitle(string $title) : UserGroupEntity
82
    {
83
        $this->container['title'] = $title;
84
85
        return $this;
86
    }
87
88
    /**
89
     * @return null|string
90
     */
91
    public function getTitle() : ? string
92
    {
93
        return $this->container['title'];
94
    }
95
96
    /**
97
     * @param string $description
98
     * @return UserGroupEntity
99
     */
100
    public function setDescription(string $description) : UserGroupEntity
101
    {
102
        $this->container['description'] = $description;
103
104
        return $this;
105
    }
106
107
    /**
108
     * @return null|string
109
     */
110
    public function getDescription() : ? string
111
    {
112
        return $this->container['description'];
113
    }
114
115
    /**
116
     * @param bool $isReadonly
117
     * @return UserGroupEntity
118
     */
119
    public function setIsReadOnly(bool $isReadonly) : UserGroupEntity
120
    {
121
        $this->container['is_read_only'] = $isReadonly ? 1 : 0;
122
123
        return $this;
124
    }
125
126
    /**
127
     * @return bool
128
     */
129
    public function getIsReadOnly() : bool
130
    {
131
        return !empty($this->container['is_read_only']);
132
    }
133
134
    /**
135
     * @param DateTime $dateTime
136
     * @return UserGroupEntity
137
     */
138
    public function setDateCreated(DateTime $dateTime) : UserGroupEntity
139
    {
140
        $this->container['date_created'] = $dateTime->format('Y-m-d H:i:s');
141
142
        return $this;
143
    }
144
145
    /**
146
     * @return null|DateTime
147
     */
148
    public function getDateCreated() : ? DateTime
149
    {
150
        return !empty($this->container['date_created'])
151
            ? new DateTime($this->container['date_created'])
152
            : null;
153
    }
154
155
    /**
156
     * @param DateTime $dateTime
157
     * @return UserGroupEntity
158
     */
159
    public function setDateModified(DateTime $dateTime) : UserGroupEntity
160
    {
161
        $this->container['date_modified'] = $dateTime->format('Y-m-d H:i:s');
162
163
        return $this;
164
    }
165
166
    /**
167
     * @return null|DateTime
168
     */
169
    public function getDateModified() : ? DateTime
170
    {
171
        return !empty($this->container['date_modified'])
172
            ? new DateTime($this->container['date_modified'])
173
            : null;
174
    }
175
}
176