Passed
Push — master ( 8587fa...100bd0 )
by Gabor
04:15
created

PolicyEntity::setMethod()   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 bool */
41
    private $isAllowed;
42
    /** @var DateTime */
43
    private $dateCreated;
44
    /** @var DateTime */
45
    private $dateModified;
46
47
    /**
48
     * Sets the value of the entity identifier.
49
     *
50
     * @param int $entityId
51
     * @return PolicyEntity
52
     */
53 1
    public function setKeyData(int $entityId) : PolicyEntity
54
    {
55 1
        $this->policyId = $entityId;
56
57 1
        return $this;
58
    }
59
60
    /**
61
     * Gets the value of the entity identifier.
62
     *
63
     * @return null|int
64
     */
65 4
    public function getKeyData() : ? int
66
    {
67 4
        return $this->policyId;
68
    }
69
70
    /**
71
     * @param int $policyId
72
     * @return PolicyEntity
73
     */
74 9
    public function setPolicyId(int $policyId) : PolicyEntity
75
    {
76 9
        $this->policyId = $policyId;
77
78 9
        return $this;
79
    }
80
81
    /**
82
     * @return null|int
83
     */
84 2
    public function getPolicyId() : ? int
85
    {
86 2
        return $this->policyId;
87
    }
88
89
    /**
90
     * @param null|int $resource
91
     * @return PolicyEntity
92
     */
93 10
    public function setResourceId(? int $resource) : PolicyEntity
94
    {
95 10
        $this->resourceId = $resource;
96
97 10
        return $this;
98
    }
99
100
    /**
101
     * @return null|int
102
     */
103 6
    public function getResourceId() : ? int
104
    {
105 6
        return $this->resourceId;
106
    }
107
108
    /**
109
     * @param null|int $applicationId
110
     * @return PolicyEntity
111
     */
112 10
    public function setApplicationId(? int $applicationId) : PolicyEntity
113
    {
114 10
        $this->applicationId = $applicationId;
115
116 10
        return $this;
117
    }
118
119
    /**
120
     * @return null|int
121
     */
122 6
    public function getApplicationId() : ? int
123
    {
124 6
        return $this->applicationId;
125
    }
126
127
    /**
128
     * @param string $name
129
     * @return PolicyEntity
130
     */
131 8
    public function setName(string $name) : PolicyEntity
132
    {
133 8
        $this->name = $name;
134
135 8
        return $this;
136
    }
137
138
    /**
139
     * @return null|string
140
     */
141 4
    public function getName() : ? string
142
    {
143 4
        return $this->name;
144
    }
145
146
    /**
147
     * @param string $title
148
     * @return PolicyEntity
149
     */
150 8
    public function setTitle(string $title) : PolicyEntity
151
    {
152 8
        $this->title = $title;
153
154 8
        return $this;
155
    }
156
157
    /**
158
     * @return null|string
159
     */
160 6
    public function getTitle() : ? string
161
    {
162 6
        return $this->title;
163
    }
164
165
    /**
166
     * @param string $description
167
     * @return PolicyEntity
168
     */
169 8
    public function setDescription(string $description) : PolicyEntity
170
    {
171 8
        $this->description = $description;
172
173 8
        return $this;
174
    }
175
176
    /**
177
     * @return null|string
178
     */
179 4
    public function getDescription() : ? string
180
    {
181 4
        return $this->description;
182
    }
183
184
    /**
185
     * @param null|string $method
186
     * @return PolicyEntity
187
     */
188 6
    public function setMethod(? string $method) : PolicyEntity
189
    {
190 6
        $this->method = $method;
191
192 6
        return $this;
193
    }
194
195
    /**
196
     * @return null|string
197
     */
198 4
    public function getMethod() : ? string
199
    {
200 4
        return $this->method;
201
    }
202
203
    /**
204
     * @param bool $state
205
     * @return PolicyEntity
206
     */
207 8
    public function setReadOnly(bool $state) : PolicyEntity
208
    {
209 8
        $this->isReadOnly = $state;
210
211 8
        return $this;
212
    }
213
214
    /**
215
     * @return bool
216
     */
217 4
    public function getReadOnly() : bool
218
    {
219 4
        return $this->isReadOnly ?? false;
220
    }
221
222
    /**
223
     * @param bool $state
224
     * @return PolicyEntity
225
     */
226 8
    public function setAllowed(bool $state) : PolicyEntity
227
    {
228 8
        $this->isAllowed = $state;
229
230 8
        return $this;
231
    }
232
233
    /**
234
     * @return bool
235
     */
236 7
    public function getAllowed() : bool
237
    {
238 7
        return $this->isAllowed ?? false;
239
    }
240
241
    /**
242
     * @param DateTime $dateCreated
243
     * @return PolicyEntity
244
     */
245 8
    public function setDateCreated(DateTime $dateCreated) : PolicyEntity
246
    {
247 8
        $this->dateCreated = $dateCreated;
248
249 8
        return $this;
250
    }
251
252
    /**
253
     * @return null|DateTime
254
     */
255 4
    public function getDateCreated() : ? DateTime
256
    {
257 4
        return $this->dateCreated;
258
    }
259
260
    /**
261
     * @param DateTime $dateModified
262
     * @return PolicyEntity
263
     */
264 8
    public function setDateModified(DateTime $dateModified) : PolicyEntity
265
    {
266 8
        $this->dateModified = $dateModified;
267
268 8
        return $this;
269
    }
270
271
    /**
272
     * @return null|DateTime
273
     */
274 4
    public function getDateModified() : ? DateTime
275
    {
276 4
        return $this->dateModified;
277
    }
278
}
279