Passed
Push — develop ( b22678...97e476 )
by Daniel
08:45
created

FeatureStackedItem::setButtonClass()   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 1
dl 0
loc 3
ccs 0
cts 2
cp 0
crap 2
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Silverback\ApiComponentBundle\Entity\Component\Feature\Stacked;
6
7
use Doctrine\ORM\Mapping as ORM;
8
use Silverback\ApiComponentBundle\Entity\Component\Feature\AbstractFeatureItem;
9
use Silverback\ApiComponentBundle\Entity\Component\FileInterface;
10
use Silverback\ApiComponentBundle\Entity\Component\FileTrait;
11
use Symfony\Component\Serializer\Annotation\Groups;
12
use Symfony\Component\Validator\Constraints as Assert;
13
use Symfony\Component\Validator\Mapping\ClassMetadata;
14
15
/**
16
 * Class FeatureStackedItem
17
 * @package Silverback\ApiComponentBundle\Entity\Component\FeatureList
18
 * @author Daniel West <[email protected]>
19
 * @ORM\Entity()
20
 */
21
class FeatureStackedItem 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
    /**
33
     * @ORM\Column()
34
     * @Groups({"component", "content"})
35
     * @var null|string
36
     */
37
    protected $buttonText;
38
39
    /**
40
     * @ORM\Column()
41
     * @Groups({"component", "content"})
42
     * @var null|string
43
     */
44
    protected $buttonClass;
45
46 1
    public static function loadValidatorMetadata(ClassMetadata $metadata)
47
    {
48 1
        $metadata->addPropertyConstraint(
49 1
            'description',
50 1
            new Assert\NotBlank()
51
        );
52 1
        $metadata->addPropertyConstraint(
53 1
            'filePath',
54 1
            new Assert\Image()
55
        );
56 1
    }
57
58
    /**
59
     * @return null|string
60
     */
61
    public function getDescription(): ?string
62
    {
63
        return $this->description;
64
    }
65
66
    /**
67
     * @param null|string $description
68
     */
69
    public function setDescription(?string $description): void
70
    {
71
        $this->description = $description;
72
    }
73
74
    /**
75
     * @return null|string
76
     */
77
    public function getButtonText(): ?string
78
    {
79
        return $this->buttonText;
80
    }
81
82
    /**
83
     * @param null|string $buttonText
84
     */
85
    public function setButtonText(?string $buttonText): void
86
    {
87
        $this->buttonText = $buttonText;
88
    }
89
90
    /**
91
     * @return null|string
92
     */
93
    public function getButtonClass(): ?string
94
    {
95
        return $this->buttonClass;
96
    }
97
98
    /**
99
     * @param null|string $buttonClass
100
     */
101
    public function setButtonClass(?string $buttonClass): void
102
    {
103
        $this->buttonClass = $buttonClass;
104
    }
105
}
106