Passed
Push — v2 ( e7f8e2...a41bff )
by Daniel
04:01
created

FileTrait::getFileData()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 1
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 3
ccs 0
cts 2
cp 0
crap 2
rs 10
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 ApiPlatform\Core\Annotation\ApiProperty;
17
use Doctrine\ORM\Mapping as ORM;
18
use Silverback\ApiComponentBundle\Dto\File\FileData;
19
20
/**
21
 * @author Daniel West <[email protected]>
22
 */
23
trait FileTrait
24
{
25
    /**
26
     * @ORM\Column(type="string", nullable=true)
27
     * @ApiProperty(iri="http://schema.org/contentUrl")
28
     */
29
    private ?string $filePath;
30
31
    private ?FileData $fileData = null;
32
33
    public function getFilePath(): ?string
34
    {
35
        return $this->filePath;
36
    }
37
38
    /**
39
     * @return static
40
     */
41
    public function setFilePath(?string $filePath)
42
    {
43
        $this->filePath = $filePath;
44
45
        return $this;
46
    }
47
48
    /**
49
     * @return static
50
     */
51
    public function setFileData(FileData $fileData)
52
    {
53
        $this->fileData = $fileData;
54
55
        return $this;
56
    }
57
58
    public function getFileData(): ?FileData
59
    {
60
        return $this->fileData;
61
    }
62
63
    public static function getImagineFilters(): array
64
    {
65
        return [
66
            'thumbnail' => 'thumbnail',
67
            'placeholderSquare' => 'placeholder_square',
68
            'placeholder' => 'placeholder',
69
        ];
70
    }
71
72
    public function getDirectory(): ?string
73
    {
74
        return null;
75
    }
76
}
77