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

FilesystemDirectoryEntity   A

Complexity

Total Complexity 18

Size/Duplication

Total Lines 152
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 152
ccs 41
cts 41
cp 1
rs 10
c 0
b 0
f 0
wmc 18

14 Methods

Rating   Name   Duplication   Size   Complexity  
A getDescription() 0 3 1
A setDateModified() 0 5 1
A setFilesystemDirectoryId() 0 5 1
A setIsAutoIndex() 0 5 2
A getFilesystemDirectoryId() 0 5 2
A setDescription() 0 5 1
A getIsAutoIndex() 0 3 1
A setDirectoryType() 0 5 1
A getDateCreated() 0 5 2
A getDateModified() 0 5 2
A getProxy() 0 3 1
A setDateCreated() 0 5 1
A setProxy() 0 5 1
A getDirectoryType() 0 3 1
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 FilesystemDirectoryEntity
20
 */
21
class FilesystemDirectoryEntity extends AbstractEntity
22
{
23
    /**
24
     * @var array
25
     */
26
    protected $container = [
27
        'id_filesystem_directory' => null,
28
        'description' => null,
29
        'directory_type' => null,
30
        'proxy' => null,
31
        'is_autoindex' => null,
32
        'date_created' => null,
33
        'date_modified' => null,
34
    ];
35
36
    /**
37
     * @param int $identifier
38
     * @return FilesystemDirectoryEntity
39
     */
40 1
    public function setFilesystemDirectoryId(int $identifier) : FilesystemDirectoryEntity
41
    {
42 1
        $this->container['id_filesystem_directory'] = $identifier;
43
44 1
        return $this;
45
    }
46
47
    /**
48
     * @return int|null
49
     */
50 1
    public function getFilesystemDirectoryId() : ? int
51
    {
52 1
        return !is_null($this->container['id_filesystem_directory'])
53 1
            ? (int) $this->container['id_filesystem_directory']
54 1
            : null;
55
    }
56
57
    /**
58
     * @param string $description
59
     * @return FilesystemDirectoryEntity
60
     */
61 1
    public function setDescription(string $description) : FilesystemDirectoryEntity
62
    {
63 1
        $this->container['description'] = $description;
64
65 1
        return $this;
66
    }
67
68
    /**
69
     * @return null|string
70
     */
71 1
    public function getDescription() : ? string
72
    {
73 1
        return $this->container['description'];
74
    }
75
76
    /**
77
     * @param string $directoryType
78
     * @return FilesystemDirectoryEntity
79
     */
80 1
    public function setDirectoryType(string $directoryType) : FilesystemDirectoryEntity
81
    {
82 1
        $this->container['directory_type'] = $directoryType;
83
84 1
        return $this;
85
    }
86
87
    /**
88
     * @return null|string
89
     */
90 1
    public function getDirectoryType() : ? string
91
    {
92 1
        return $this->container['directory_type'];
93
    }
94
95
    /**
96
     * @param string $proxy
97
     * @return FilesystemDirectoryEntity
98
     */
99 1
    public function setProxy(string $proxy) : FilesystemDirectoryEntity
100
    {
101 1
        $this->container['proxy'] = $proxy;
102
103 1
        return $this;
104
    }
105
106
    /**
107
     * @return null|string
108
     */
109 1
    public function getProxy() : ? string
110
    {
111 1
        return $this->container['proxy'];
112
    }
113
114
    /**
115
     * @param bool $isAutoindex
116
     * @return FilesystemDirectoryEntity
117
     */
118 1
    public function setIsAutoIndex(bool $isAutoindex) : FilesystemDirectoryEntity
119
    {
120 1
        $this->container['is_autoindex'] = $isAutoindex ? 1 : 0;
121
122 1
        return $this;
123
    }
124
125
    /**
126
     * @return bool
127
     */
128 1
    public function getIsAutoIndex() : bool
129
    {
130 1
        return !empty($this->container['is_autoindex']);
131
    }
132
133
    /**
134
     * @param DateTime $dateTime
135
     * @return FilesystemDirectoryEntity
136
     */
137 1
    public function setDateCreated(DateTime $dateTime) : FilesystemDirectoryEntity
138
    {
139 1
        $this->container['date_created'] = $dateTime->format('Y-m-d H:i:s');
140
141 1
        return $this;
142
    }
143
144
    /**
145
     * @return null|DateTime
146
     */
147 1
    public function getDateCreated() : ? DateTime
148
    {
149 1
        return !empty($this->container['date_created'])
150 1
            ? new DateTime($this->container['date_created'])
151 1
            : null;
152
    }
153
154
    /**
155
     * @param DateTime $dateTime
156
     * @return FilesystemDirectoryEntity
157
     */
158 1
    public function setDateModified(DateTime $dateTime) : FilesystemDirectoryEntity
159
    {
160 1
        $this->container['date_modified'] = $dateTime->format('Y-m-d H:i:s');
161
162 1
        return $this;
163
    }
164
165
    /**
166
     * @return null|DateTime
167
     */
168 1
    public function getDateModified() : ? DateTime
169
    {
170 1
        return !empty($this->container['date_modified'])
171 1
            ? new DateTime($this->container['date_modified'])
172 1
            : null;
173
    }
174
}
175