Completed
Push — develop ( 771d14...2a7966 )
by Daniel
06:05
created

FeatureColumnsItem   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getDescription() 0 3 1
A setDescription() 0 3 1
A loadValidatorMetadata() 0 5 1
1
<?php
2
3
namespace Silverback\ApiComponentBundle\Entity\Content\Component\Feature\Columns;
4
5
use ApiPlatform\Core\Annotation\ApiResource;
6
use Doctrine\ORM\Mapping as ORM;
7
use Silverback\ApiComponentBundle\Entity\Content\Component\Feature\AbstractFeatureItem;
8
use Silverback\ApiComponentBundle\Entity\Content\FileInterface;
9
use Silverback\ApiComponentBundle\Entity\Content\FileTrait;
10
use Symfony\Component\Serializer\Annotation\Groups;
11
use Symfony\Component\Validator\Constraints as Assert;
12
use Symfony\Component\Validator\Mapping\ClassMetadata;
13
14
/**
15
 * Class FeatureColumnsItem
16
 * @package Silverback\ApiComponentBundle\Entity\Content\Component\FeatureList
17
 * @author Daniel West <[email protected]>
18
 * @ApiResource()
19
 * @ORM\Entity()
20
 */
21
class FeatureColumnsItem extends AbstractFeatureItem implements FileInterface
22
{
23
    use FileTrait;
24
25
    /**
26
     * @ORM\Column()
27
     * @Groups({"component", "content"})
28
     * @var null|string
29
     */
30
    protected $description;
31
32 4
    public static function loadValidatorMetadata(ClassMetadata $metadata)
33
    {
34 4
        $metadata->addPropertyConstraint(
35 4
            'filePath',
36 4
            new Assert\Image()
37
        );
38 4
    }
39
40
    /**
41
     * @return null|string
42
     */
43 1
    public function getDescription(): ?string
44
    {
45 1
        return $this->description;
46
    }
47
48
    /**
49
     * @param null|string $description
50
     */
51 1
    public function setDescription(?string $description): void
52
    {
53 1
        $this->description = $description;
54 1
    }
55
}
56