Passed
Push — master ( 97f73d...f32c79 )
by Gabor
08:10
created

PolicyEntity   A

Complexity

Total Complexity 22

Size/Duplication

Total Lines 236
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 22
lcom 2
cbo 0
dl 0
loc 236
ccs 55
cts 55
cp 1
rs 10
c 0
b 0
f 0

22 Methods

Rating   Name   Duplication   Size   Complexity  
A setResourceId() 0 6 1
A getResourceId() 0 4 1
A setApplicationId() 0 6 1
A getApplicationId() 0 4 1
A getDateModified() 0 4 1
A setKeyData() 0 6 1
A getKeyData() 0 4 1
A setPolicyId() 0 6 1
A getPolicyId() 0 4 1
A setName() 0 6 1
A getName() 0 4 1
A setTitle() 0 6 1
A getTitle() 0 4 1
A setDescription() 0 6 1
A getDescription() 0 4 1
A setReadOnly() 0 6 1
A getReadOnly() 0 4 1
A setAllowed() 0 6 1
A getAllowed() 0 4 1
A setDateCreated() 0 6 1
A getDateCreated() 0 4 1
A setDateModified() 0 6 1
1
<?php
2
/**
3
 * WebHemi.
4
 *
5
 * PHP version 7.1
6
 *
7
 * @copyright 2012 - 2017 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\AccessManagement;
15
16
use WebHemi\DateTime;
17
use WebHemi\Data\Entity\DataEntityInterface;
18
19
/**
20
 * Class PolicyEntity.
21
 */
22
class PolicyEntity implements DataEntityInterface
23
{
24
    /** @var int */
25
    private $policyId;
26
    /** @var int */
27
    private $resourceId;
28
    /** @var int */
29
    private $applicationId;
30
    /** @var string */
31
    private $name;
32
    /** @var string */
33
    private $title;
34
    /** @var string */
35
    private $description;
36
    /** @var bool */
37
    private $isReadOnly;
38
    /** @var bool */
39
    private $isAllowed;
40
    /** @var DateTime */
41
    private $dateCreated;
42
    /** @var DateTime */
43
    private $dateModified;
44
45
    /**
46
     * Sets the value of the entity identifier.
47
     *
48
     * @param int $entityId
49
     * @return PolicyEntity
50
     */
51 1
    public function setKeyData(int $entityId) : PolicyEntity
52
    {
53 1
        $this->policyId = $entityId;
54
55 1
        return $this;
56
    }
57
58
    /**
59
     * Gets the value of the entity identifier.
60
     *
61
     * @return null|int
62
     */
63 4
    public function getKeyData() : ? int
64
    {
65 4
        return $this->policyId;
66
    }
67
68
    /**
69
     * @param int $policyId
70
     * @return PolicyEntity
71
     */
72 8
    public function setPolicyId(int $policyId) : PolicyEntity
73
    {
74 8
        $this->policyId = $policyId;
75
76 8
        return $this;
77
    }
78
79
    /**
80
     * @return null|int
81
     */
82 2
    public function getPolicyId() : ? int
83
    {
84 2
        return $this->policyId;
85
    }
86
87
    /**
88
     * @param null|int $resource
89
     * @return PolicyEntity
90
     */
91 9
    public function setResourceId(? int $resource) : PolicyEntity
92
    {
93 9
        $this->resourceId = $resource;
94
95 9
        return $this;
96
    }
97
98
    /**
99
     * @return null|int
100
     */
101 5
    public function getResourceId() : ? int
102
    {
103 5
        return $this->resourceId;
104
    }
105
106
    /**
107
     * @param null|int $applicationId
108
     * @return PolicyEntity
109
     */
110 9
    public function setApplicationId(? int $applicationId) : PolicyEntity
111
    {
112 9
        $this->applicationId = $applicationId;
113
114 9
        return $this;
115
    }
116
117
    /**
118
     * @return null|int
119
     */
120 5
    public function getApplicationId() : ? int
121
    {
122 5
        return $this->applicationId;
123
    }
124
125
    /**
126
     * @param string $name
127
     * @return PolicyEntity
128
     */
129 7
    public function setName(string $name) : PolicyEntity
130
    {
131 7
        $this->name = $name;
132
133 7
        return $this;
134
    }
135
136
    /**
137
     * @return null|string
138
     */
139 4
    public function getName() : ? string
140
    {
141 4
        return $this->name;
142
    }
143
144
    /**
145
     * @param string $title
146
     * @return PolicyEntity
147
     */
148 7
    public function setTitle(string $title) : PolicyEntity
149
    {
150 7
        $this->title = $title;
151
152 7
        return $this;
153
    }
154
155
    /**
156
     * @return null|string
157
     */
158 6
    public function getTitle() : ? string
159
    {
160 6
        return $this->title;
161
    }
162
163
    /**
164
     * @param string $description
165
     * @return PolicyEntity
166
     */
167 7
    public function setDescription(string $description) : PolicyEntity
168
    {
169 7
        $this->description = $description;
170
171 7
        return $this;
172
    }
173
174
    /**
175
     * @return null|string
176
     */
177 4
    public function getDescription() : ? string
178
    {
179 4
        return $this->description;
180
    }
181
182
    /**
183
     * @param bool $state
184
     * @return PolicyEntity
185
     */
186 7
    public function setReadOnly(bool $state) : PolicyEntity
187
    {
188 7
        $this->isReadOnly = $state;
189
190 7
        return $this;
191
    }
192
193
    /**
194
     * @return bool
195
     */
196 4
    public function getReadOnly() : bool
197
    {
198 4
        return $this->isReadOnly ?? false;
199
    }
200
201
    /**
202
     * @param bool $state
203
     * @return PolicyEntity
204
     */
205 7
    public function setAllowed(bool $state) : PolicyEntity
206
    {
207 7
        $this->isAllowed = $state;
208
209 7
        return $this;
210
    }
211
212
    /**
213
     * @return bool
214
     */
215 6
    public function getAllowed() : bool
216
    {
217 6
        return $this->isAllowed ?? false;
218
    }
219
220
    /**
221
     * @param DateTime $dateCreated
222
     * @return PolicyEntity
223
     */
224 7
    public function setDateCreated(DateTime $dateCreated) : PolicyEntity
225
    {
226 7
        $this->dateCreated = $dateCreated;
227
228 7
        return $this;
229
    }
230
231
    /**
232
     * @return null|DateTime
233
     */
234 4
    public function getDateCreated() : ? DateTime
235
    {
236 4
        return $this->dateCreated;
237
    }
238
239
    /**
240
     * @param DateTime $dateModified
241
     * @return PolicyEntity
242
     */
243 7
    public function setDateModified(DateTime $dateModified) : PolicyEntity
244
    {
245 7
        $this->dateModified = $dateModified;
246
247 7
        return $this;
248
    }
249
250
    /**
251
     * @return null|DateTime
252
     */
253 4
    public function getDateModified() : ? DateTime
254
    {
255 4
        return $this->dateModified;
256
    }
257
}
258