Test Failed
Push — master ( af24cd...6773e9 )
by Gabor
06:13
created

ResourceEntity::setType()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 6
ccs 2
cts 2
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 ResourceEntity.
21
 */
22
class ResourceEntity implements EntityInterface
23
{
24
    /** @var int */
25
    private $resourceId;
26
    /** @var string */
27
    private $name;
28
    /** @var string */
29
    private $title;
30
    /** @var string */
31
    private $description;
32
    /** @var string */
33
    private $type;
34
    /** @var bool */
35
    private $isReadOnly;
36
    /** @var DateTime */
37
    private $dateCreated;
38
    /** @var DateTime */
39
    private $dateModified;
40
41
    /**
42
     * Sets the value of the entity identifier.
43
     *
44
     * @param int $entityId
45 3
     * @return ResourceEntity
46
     */
47 3
    public function setKeyData(int $entityId) : ResourceEntity
48
    {
49 3
        $this->resourceId = $entityId;
50
51
        return $this;
52
    }
53
54
    /**
55
     * Gets the value of the entity identifier.
56
     *
57 5
     * @return null|int
58
     */
59 5
    public function getKeyData() : ? int
60
    {
61
        return $this->resourceId;
62
    }
63
64
    /**
65
     * @param int $resourceId
66 6
     * @return ResourceEntity
67
     */
68 6
    public function setResourceId(int $resourceId) : ResourceEntity
69
    {
70 6
        $this->resourceId = $resourceId;
71
72
        return $this;
73
    }
74
75
    /**
76 3
     * @return null|int
77
     */
78 3
    public function getResourceId() : ? int
79
    {
80
        return $this->resourceId;
81
    }
82
83
    /**
84
     * @param string $name
85 6
     * @return ResourceEntity
86
     */
87 6
    public function setName(string $name) : ResourceEntity
88
    {
89 6
        $this->name = $name;
90
91
        return $this;
92
    }
93
94
    /**
95 4
     * @return null|string
96
     */
97 4
    public function getName() : ? string
98
    {
99
        return $this->name;
100
    }
101
102
    /**
103
     * @param string $title
104 5
     * @return ResourceEntity
105
     */
106 5
    public function setTitle(string $title) : ResourceEntity
107
    {
108 5
        $this->title = $title;
109
110
        return $this;
111
    }
112
113
    /**
114 4
     * @return null|string
115
     */
116 4
    public function getTitle() : ? string
117
    {
118
        return $this->title;
119
    }
120
121
    /**
122
     * @param string $description
123 5
     * @return ResourceEntity
124
     */
125 5
    public function setDescription(string $description) : ResourceEntity
126
    {
127 5
        $this->description = $description;
128
129
        return $this;
130
    }
131
132
    /**
133 4
     * @return null|string
134
     */
135 4
    public function getDescription() : ? string
136
    {
137
        return $this->description;
138
    }
139
140
    /**
141
     * @param string $type
142 5
     * @return ResourceEntity
143
     */
144 5
    public function setType(string $type) : ResourceEntity
145
    {
146 5
        $this->type = $type;
147
148
        return $this;
149
    }
150
151
    /**
152 4
     * @return null|string
153
     */
154 4
    public function getType() : ? string
155
    {
156
        return $this->type;
157
    }
158
159
    /**
160
     * @param bool $state
161 5
     * @return ResourceEntity
162
     */
163 5
    public function setReadOnly(bool $state) : ResourceEntity
164
    {
165 5
        $this->isReadOnly = $state;
166
167
        return $this;
168
    }
169
170
    /**
171 4
     * @return bool
172
     */
173 4
    public function getReadOnly() : bool
174
    {
175
        return $this->isReadOnly ?? false;
176
    }
177
178
    /**
179
     * @param DateTime $dateCreated
180 5
     * @return ResourceEntity
181
     */
182 5
    public function setDateCreated(DateTime $dateCreated) : ResourceEntity
183
    {
184 5
        $this->dateCreated = $dateCreated;
185
186
        return $this;
187
    }
188
189
    /**
190 4
     * @return null|DateTime
191
     */
192 4
    public function getDateCreated() : ? DateTime
193
    {
194
        return $this->dateCreated;
195
    }
196
197
    /**
198
     * @param DateTime $dateModified
199
     * @return ResourceEntity
200
     */
201
    public function setDateModified(DateTime $dateModified) : ResourceEntity
202
    {
203
        $this->dateModified = $dateModified;
204
205
        return $this;
206
    }
207
208
    /**
209
     * @return null|DateTime
210
     */
211
    public function getDateModified() : ? DateTime
212
    {
213
        return $this->dateModified;
214
    }
215
}
216