Passed
Push — master ( e14a05...ed0db1 )
by Gabor
05:13
created

FilesystemDocumentEntity::setDateCreated()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 5
ccs 3
cts 3
cp 1
crap 1
rs 9.4285
c 0
b 0
f 0
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 FilesystemDocumentEntity
20
 */
21
class FilesystemDocumentEntity extends AbstractEntity
22
{
23
    /**
24
     * @var array
25
     */
26
    protected $container = [
27
        'id_filesystem_document' => null,
28
        'fk_parent_revision' => null,
29
        'fk_author' => null,
30
        'content_revision' => null,
31
        'content_lead' => null,
32
        'content_body' => null,
33
        'date_created' => null,
34
        'date_modified' => null,
35
    ];
36
37
    /**
38
     * @param int $identifier
39
     * @return FilesystemDocumentEntity
40
     */
41 1
    public function setFilesystemDocumentId(int $identifier) : FilesystemDocumentEntity
42
    {
43 1
        $this->container['id_filesystem_document'] = $identifier;
44
45 1
        return $this;
46
    }
47
48
    /**
49
     * @return int|null
50
     */
51 1
    public function getFilesystemDocumentId() : ? int
52
    {
53 1
        return !is_null($this->container['id_filesystem_document'])
54 1
            ? (int) $this->container['id_filesystem_document']
55 1
            : null;
56
    }
57
58
    /**
59
     * @param null|int $parentRevisionIdentifier
60
     * @return FilesystemDocumentEntity
61
     */
62 1
    public function setParentRevisionId(? int $parentRevisionIdentifier) : FilesystemDocumentEntity
63
    {
64 1
        $this->container['fk_parent_revision'] = $parentRevisionIdentifier;
65
66 1
        return $this;
67
    }
68
69
    /**
70
     * @return int|null
71
     */
72 1
    public function getParentRevisionId() : ? int
73
    {
74 1
        return !is_null($this->container['fk_parent_revision'])
75 1
            ? (int) $this->container['fk_parent_revision']
76 1
            : null;
77
    }
78
79
    /**
80
     * @param null|int $authorIdentifier
81
     * @return FilesystemDocumentEntity
82
     */
83 1
    public function setAuthorId(? int $authorIdentifier) : FilesystemDocumentEntity
84
    {
85 1
        $this->container['fk_author'] = $authorIdentifier;
86
87 1
        return $this;
88
    }
89
90
    /**
91
     * @return int|null
92
     */
93 1
    public function getAuthorId() : ? int
94
    {
95 1
        return !is_null($this->container['fk_author'])
96 1
            ? (int) $this->container['fk_author']
97 1
            : null;
98
    }
99
100
    /**
101
     * @param int $contentRevision
102
     * @return FilesystemDocumentEntity
103
     */
104 1
    public function setContentRevision(? int $contentRevision) : FilesystemDocumentEntity
105
    {
106 1
        $this->container['content_revision'] = $contentRevision;
107
108 1
        return $this;
109
    }
110
111
    /**
112
     * @return int|null
113
     */
114 1
    public function getContentRevision() : ? int
115
    {
116 1
        return !is_null($this->container['content_revision'])
117 1
            ? (int) $this->container['content_revision']
118 1
            : null;
119
    }
120
121
    /**
122
     * @param string $contentLead
123
     * @return FilesystemDocumentEntity
124
     */
125 1
    public function setContentLead(string $contentLead) : FilesystemDocumentEntity
126
    {
127 1
        $this->container['content_lead'] = $contentLead;
128
129 1
        return $this;
130
    }
131
132
    /**
133
     * @return null|string
134
     */
135 1
    public function getContentLead() : ? string
136
    {
137 1
        return $this->container['content_lead'];
138
    }
139
140
    /**
141
     * @param string $contentBody
142
     * @return FilesystemDocumentEntity
143
     */
144 1
    public function setContentBody(string $contentBody) : FilesystemDocumentEntity
145
    {
146 1
        $this->container['content_body'] = $contentBody;
147
148 1
        return $this;
149
    }
150
151
    /**
152
     * @return null|string
153
     */
154 1
    public function getContentBody() : ? string
155
    {
156 1
        return $this->container['content_body'];
157
    }
158
159
    /**
160
     * @param DateTime $dateTime
161
     * @return FilesystemDocumentEntity
162
     */
163 1
    public function setDateCreated(DateTime $dateTime) : FilesystemDocumentEntity
164
    {
165 1
        $this->container['date_created'] = $dateTime->format('Y-m-d H:i:s');
166
167 1
        return $this;
168
    }
169
170
    /**
171
     * @return null|DateTime
172
     */
173 1
    public function getDateCreated() : ? DateTime
174
    {
175 1
        return !empty($this->container['date_created'])
176 1
            ? new DateTime($this->container['date_created'])
177 1
            : null;
178
    }
179
180
    /**
181
     * @param DateTime $dateTime
182
     * @return FilesystemDocumentEntity
183
     */
184 1
    public function setDateModified(DateTime $dateTime) : FilesystemDocumentEntity
185
    {
186 1
        $this->container['date_modified'] = $dateTime->format('Y-m-d H:i:s');
187
188 1
        return $this;
189
    }
190
191
    /**
192
     * @return null|DateTime
193
     */
194 1
    public function getDateModified() : ? DateTime
195
    {
196 1
        return !empty($this->container['date_modified'])
197 1
            ? new DateTime($this->container['date_modified'])
198 1
            : null;
199
    }
200
}
201