Passed
Push — develop ( 683c8d...07cc15 )
by Daniel
05:33
created

FileTrait   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 30
ccs 7
cts 7
cp 1
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getImagineFilters() 0 5 1
A setFilePath() 0 3 1
A getFilePath() 0 3 1
1
<?php
2
3
namespace Silverback\ApiComponentBundle\Entity\Component;
4
5
use Doctrine\ORM\Mapping as ORM;
6
use Silverback\ApiComponentBundle\Imagine\FileSystemLoader;
7
use Symfony\Component\Serializer\Annotation\Groups;
8
9
/**
10
 * Trait FileTrait
11
 * @package Silverback\ApiComponentBundle\Entity\Component
12
 */
13
trait FileTrait
14
{
15
    /**
16
     * @ORM\Column(type="string", nullable=false)
17
     * @Groups({"component"})
18
     * @var null|string
19
     */
20
    protected $filePath;
21
22
    /**
23
     * @return null|string
24
     */
25 3
    public function getFilePath(): ?string
26
    {
27 3
        return $this->filePath;
28
    }
29
30
    /**
31
     * @param null|string $filePath
32
     */
33 3
    public function setFilePath(?string $filePath): void
34
    {
35 3
        $this->filePath = $filePath;
36 3
    }
37
38 1
    public static function getImagineFilters(): array
39
    {
40
        return [
41 1
            'thumbnailPath' => 'thumbnail',
42
            'placeholderPath' => 'placeholder_square'
43
        ];
44
    }
45
}
46