Passed
Push — master ( 00b675...b5f4af )
by Gabor
06:20
created

PolicyEntity::setAllowed()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 6
ccs 3
cts 3
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 1
crap 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\Data\EntityInterface;
17
use WebHemi\DateTime;
18
19
/**
20
 * Class PolicyEntity.
21
 */
22
class PolicyEntity implements EntityInterface
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 string */
37
    private $method;
38
    /** @var bool */
39
    private $isReadOnly;
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 5
    public function getKeyData() : ? int
64
    {
65 5
        return $this->policyId;
66
    }
67
68
    /**
69
     * @param int $policyId
70
     * @return PolicyEntity
71
     */
72 10
    public function setPolicyId(int $policyId) : PolicyEntity
73
    {
74 10
        $this->policyId = $policyId;
75
76 10
        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 11
    public function setResourceId(? int $resource) : PolicyEntity
92
    {
93 11
        $this->resourceId = $resource;
94
95 11
        return $this;
96
    }
97
98
    /**
99
     * @return null|int
100
     */
101 7
    public function getResourceId() : ? int
102
    {
103 7
        return $this->resourceId;
104
    }
105
106
    /**
107
     * @param null|int $applicationId
108
     * @return PolicyEntity
109
     */
110 11
    public function setApplicationId(? int $applicationId) : PolicyEntity
111
    {
112 11
        $this->applicationId = $applicationId;
113
114 11
        return $this;
115
    }
116
117
    /**
118
     * @return null|int
119
     */
120 7
    public function getApplicationId() : ? int
121
    {
122 7
        return $this->applicationId;
123
    }
124
125
    /**
126
     * @param string $name
127
     * @return PolicyEntity
128
     */
129 9
    public function setName(string $name) : PolicyEntity
130
    {
131 9
        $this->name = $name;
132
133 9
        return $this;
134
    }
135
136
    /**
137
     * @return null|string
138
     */
139 5
    public function getName() : ? string
140
    {
141 5
        return $this->name;
142
    }
143
144
    /**
145
     * @param string $title
146
     * @return PolicyEntity
147
     */
148 9
    public function setTitle(string $title) : PolicyEntity
149
    {
150 9
        $this->title = $title;
151
152 9
        return $this;
153
    }
154
155
    /**
156
     * @return null|string
157
     */
158 7
    public function getTitle() : ? string
159
    {
160 7
        return $this->title;
161
    }
162
163
    /**
164
     * @param string $description
165
     * @return PolicyEntity
166
     */
167 9
    public function setDescription(string $description) : PolicyEntity
168
    {
169 9
        $this->description = $description;
170
171 9
        return $this;
172
    }
173
174
    /**
175
     * @return null|string
176
     */
177 5
    public function getDescription() : ? string
178
    {
179 5
        return $this->description;
180
    }
181
182
    /**
183
     * @param null|string $method
184
     * @return PolicyEntity
185
     */
186 7
    public function setMethod(? string $method) : PolicyEntity
187
    {
188 7
        $this->method = $method;
189
190 7
        return $this;
191
    }
192
193
    /**
194
     * @return null|string
195
     */
196 5
    public function getMethod() : ? string
197
    {
198 5
        return $this->method;
199
    }
200
201
    /**
202
     * @param bool $state
203
     * @return PolicyEntity
204
     */
205 9
    public function setReadOnly(bool $state) : PolicyEntity
206
    {
207 9
        $this->isReadOnly = $state;
208
209 9
        return $this;
210
    }
211
212
    /**
213
     * @return bool
214
     */
215 7
    public function getReadOnly() : bool
216
    {
217 7
        return $this->isReadOnly ?? false;
218
    }
219
220
    /**
221
     * @param DateTime $dateCreated
222
     * @return PolicyEntity
223
     */
224 9
    public function setDateCreated(DateTime $dateCreated) : PolicyEntity
225
    {
226 9
        $this->dateCreated = $dateCreated;
227
228 9
        return $this;
229
    }
230
231
    /**
232
     * @return null|DateTime
233
     */
234 5
    public function getDateCreated() : ? DateTime
235
    {
236 5
        return $this->dateCreated;
237
    }
238
239
    /**
240
     * @param DateTime $dateModified
241
     * @return PolicyEntity
242
     */
243 9
    public function setDateModified(DateTime $dateModified) : PolicyEntity
244
    {
245 9
        $this->dateModified = $dateModified;
246
247 9
        return $this;
248
    }
249
250
    /**
251
     * @return null|DateTime
252
     */
253 5
    public function getDateModified() : ? DateTime
254
    {
255 5
        return $this->dateModified;
256
    }
257
}
258