Completed
Push — develop ( f21c4e...9941da )
by Daniel
10:22
created

FileTrait::getDir()   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
nc 1
nop 0
dl 0
loc 3
ccs 0
cts 0
cp 0
crap 2
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Silverback\ApiComponentBundle\Entity\Content;
4
5
use ApiPlatform\Core\Annotation\ApiProperty;
6
use Doctrine\ORM\Mapping as ORM;
7
use Symfony\Component\Serializer\Annotation\Groups;
8
9
/**
10
 * Trait FileTrait
11
 * @package Silverback\ApiComponentBundle\Entity\Content\Component
12
 */
13
trait FileTrait
14
{
15
    /**
16
     * We are not asserting this is a file here because it may be a string for dynamic component e.g. {{ filePath }}
17
     * validation constraint could be made perhaps to validate a file or a variable
18
     * @ORM\Column(type="string", nullable=false)
19
     * @Groups({"component", "content"})
20
     * @ApiProperty(iri="http://schema.org/contentUrl")
21
     * @var null|string
22
     */
23
    protected $filePath;
24
25
    /**
26
     * @return null|string
27
     */
28 6
    public function getFilePath(): ?string
29
    {
30 6
        return $this->filePath;
31
    }
32
33
    /**
34
     * @param null|string $filePath
35
     */
36 4
    public function setFilePath(?string $filePath): void
37
    {
38 4
        $this->filePath = $filePath;
39 4
    }
40
41 1
    public static function getImagineFilters(): array
42
    {
43
        return [
44 1
            'thumbnail' => 'thumbnail',
45
            'placeholderSquare' => 'placeholder_square',
46
            'placeholder' => 'placeholder'
47
        ];
48
    }
49
50
    public function getDir(): ?string
51
    {
52
        return null;
53
    }
54
}
55