Passed
Pull Request — master (#52)
by Vincent
11:12 queued 04:00
created

UploadableTrait   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
eloc 9
c 1
b 0
f 0
dl 0
loc 31
ccs 0
cts 10
cp 0
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A setFileName() 0 5 1
A getFile() 0 3 1
A getFileName() 0 3 1
A setFile() 0 5 1
1
<?php
2
3
/*
4
 * This file is part of the Silverback API Component Bundle Project
5
 *
6
 * (c) Daniel West <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
declare(strict_types=1);
13
14
namespace Silverback\ApiComponentBundle\Entity\Utility;
15
16
use Silverback\ApiComponentBundle\Annotation as Silverback;
17
use Symfony\Component\HttpFoundation\File\UploadedFile;
18
19
/**
20
 * @author Vincent Chalamon <[email protected]>
21
 */
22
trait UploadableTrait
23
{
24
    private ?string $fileName = null;
25
26
    /**
27
     * @Silverback\UploadableField
28
     */
29
    private ?UploadedFile $file = null;
30
31
    public function getFileName(): ?string
32
    {
33
        return $this->fileName;
34
    }
35
36
    public function setFileName(?string $fileName): self
37
    {
38
        $this->fileName = $fileName;
39
40
        return $this;
41
    }
42
43
    public function getFile(): ?UploadedFile
44
    {
45
        return $this->file;
46
    }
47
48
    public function setFile(?UploadedFile $file): self
49
    {
50
        $this->file = $file;
51
52
        return $this;
53
    }
54
}
55