Passed
Push — master ( 83c82e...d076ea )
by Julito
09:11
created

ResourceFile::setExtension()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 5
rs 10
c 0
b 0
f 0
1
<?php
2
/* For licensing terms, see /license.txt */
3
4
namespace Chamilo\CoreBundle\Entity\Resource;
5
6
use Doctrine\ORM\Mapping as ORM;
7
use Gedmo\Mapping\Annotation as Gedmo;
8
use Symfony\Component\Validator\Constraints as Assert;
9
10
/**
11
 * @ORM\Entity
12
 * @ORM\Table(name="resource_file")
13
 */
14
class ResourceFile
15
{
16
    /**
17
     * @ORM\Id
18
     * @ORM\Column(type="integer")
19
     * @ORM\GeneratedValue
20
     */
21
    protected $id;
22
23
    /**
24
     * @ORM\Column()
25
     * @Assert\NotBlank()
26
     */
27
    protected $name;
28
29
    /**
30
     * @var string
31
     *
32
     * @Assert\NotBlank()
33
     *
34
     * @ORM\Column(name="hash", type="string", nullable=false)
35
     */
36
    protected $hash;
37
38
    /**
39
     * @Assert\NotBlank()
40
     *
41
     * @var string
42
     *
43
     * @ORM\Column(name="original_filename", type="string", nullable=false)
44
     */
45
    protected $originalFilename;
46
47
    /**
48
     * @Assert\NotBlank()
49
     *
50
     * @var string
51
     *
52
     * @ORM\Column(name="size", type="string", nullable=false)
53
     */
54
    protected $size;
55
56
    /**
57
     * @Assert\NotBlank()
58
     *
59
     * @var string
60
     *
61
     * @ORM\Column(name="width", type="string", nullable=true)
62
     */
63
    protected $width;
64
65
    /**
66
     * @Assert\NotBlank()
67
     *
68
     * @var string
69
     *
70
     * @ORM\Column(name="height", type="string", nullable=true)
71
     */
72
    protected $height;
73
74
    /**
75
     * @var string
76
     *
77
     * @ORM\Column(name="copyright", type="string", nullable=true)
78
     */
79
    protected $copyright;
80
81
    /**
82
     * @var string
83
     *
84
     * @ORM\Column(name="contentType", type="string", nullable=true)
85
     */
86
    protected $contentType;
87
88
    /**
89
     * @var string
90
     *
91
     * @ORM\Column(name="extension", type="string", nullable=false)
92
     */
93
    protected $extension;
94
95
    /**
96
     * @var ResourceNode
97
     *
98
     * @ORM\OneToOne(targetEntity="Chamilo\CoreBundle\Entity\Resource\ResourceNode", mappedBy="resourceFile")
99
     */
100
    protected $resourceNode;
101
102
    /**
103
     * @var bool
104
     *
105
     * @ORM\Column(name="enabled", type="boolean")
106
     */
107
    protected $enabled;
108
109
    /**
110
     * @ORM\Column(name="created_at", type="datetime")
111
     * @Gedmo\Timestampable(on="create")
112
     */
113
    protected $createdAt;
114
115
    /**
116
     * @ORM\Column(name="updated_at", type="datetime")
117
     * @Gedmo\Timestampable(on="update")
118
     */
119
    protected $updatedAt;
120
121
    /**
122
     * Constructor.
123
     */
124
    public function __construct()
125
    {
126
    }
127
128
    /**
129
     * @return mixed
130
     */
131
    public function getName()
132
    {
133
        return $this->name;
134
    }
135
136
    /**
137
     * @param mixed $name
138
     *
139
     * @return ResourceFile
140
     */
141
    public function setName($name)
142
    {
143
        $this->name = $name;
144
145
        return $this;
146
    }
147
148
    /**
149
     * @return string
150
     */
151
    public function getHash(): string
152
    {
153
        return $this->hash;
154
    }
155
156
    /**
157
     * @param string $hash
158
     *
159
     * @return ResourceFile
160
     */
161
    public function setHash(string $hash): ResourceFile
162
    {
163
        $this->hash = $hash;
164
165
        return $this;
166
    }
167
168
    /**
169
     * @return string
170
     */
171
    public function getOriginalFilename(): string
172
    {
173
        return $this->originalFilename;
174
    }
175
176
    /**
177
     * @param string $originalFilename
178
     *
179
     * @return ResourceFile
180
     */
181
    public function setOriginalFilename(string $originalFilename): ResourceFile
182
    {
183
        $this->originalFilename = $originalFilename;
184
185
        return $this;
186
    }
187
188
    /**
189
     * @return string
190
     */
191
    public function getSize(): string
192
    {
193
        return $this->size;
194
    }
195
196
    /**
197
     * @param string $size
198
     *
199
     * @return ResourceFile
200
     */
201
    public function setSize(string $size): ResourceFile
202
    {
203
        $this->size = $size;
204
205
        return $this;
206
    }
207
208
    /**
209
     * @return string
210
     */
211
    public function getWidth(): string
212
    {
213
        return $this->width;
214
    }
215
216
    /**
217
     * @param string $width
218
     *
219
     * @return ResourceFile
220
     */
221
    public function setWidth(string $width): ResourceFile
222
    {
223
        $this->width = $width;
224
225
        return $this;
226
    }
227
228
    /**
229
     * @return string
230
     */
231
    public function getHeight(): string
232
    {
233
        return $this->height;
234
    }
235
236
    /**
237
     * @param string $height
238
     *
239
     * @return ResourceFile
240
     */
241
    public function setHeight(string $height): ResourceFile
242
    {
243
        $this->height = $height;
244
245
        return $this;
246
    }
247
248
    /**
249
     * @return string
250
     */
251
    public function getCopyright(): string
252
    {
253
        return $this->copyright;
254
    }
255
256
    /**
257
     * @param string $copyright
258
     *
259
     * @return ResourceFile
260
     */
261
    public function setCopyright(string $copyright): ResourceFile
262
    {
263
        $this->copyright = $copyright;
264
265
        return $this;
266
    }
267
268
    /**
269
     * @return string
270
     */
271
    public function getContentType(): string
272
    {
273
        return $this->contentType;
274
    }
275
276
    /**
277
     * @param string $contentType
278
     *
279
     * @return ResourceFile
280
     */
281
    public function setContentType(string $contentType): ResourceFile
282
    {
283
        $this->contentType = $contentType;
284
285
        return $this;
286
    }
287
288
    /**
289
     * @return string
290
     */
291
    public function getExtension(): string
292
    {
293
        return $this->extension;
294
    }
295
296
    /**
297
     * @param string $extension
298
     *
299
     * @return ResourceFile
300
     */
301
    public function setExtension(string $extension): ResourceFile
302
    {
303
        $this->extension = $extension;
304
305
        return $this;
306
    }
307
308
    /**
309
     * @return ResourceNode
310
     */
311
    public function getResourceNode(): ResourceNode
312
    {
313
        return $this->resourceNode;
314
    }
315
316
    /**
317
     * @param ResourceNode $resourceNode
318
     *
319
     * @return ResourceFile
320
     */
321
    public function setResourceNode(ResourceNode $resourceNode): ResourceFile
322
    {
323
        $this->resourceNode = $resourceNode;
324
325
        return $this;
326
    }
327
328
    /**
329
     * @return bool
330
     */
331
    public function isEnabled(): bool
332
    {
333
        return $this->enabled;
334
    }
335
336
    /**
337
     * @param bool $enabled
338
     *
339
     * @return ResourceFile
340
     */
341
    public function setEnabled(bool $enabled): ResourceFile
342
    {
343
        $this->enabled = $enabled;
344
345
        return $this;
346
    }
347
348
349
}
350