Test Failed
Push — develop ( d382d0...28e0cd )
by Daniel
10:59
created

FeatureStackedItem   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 56
Duplicated Lines 0 %

Test Coverage

Coverage 61.53%

Importance

Changes 0
Metric Value
eloc 16
dl 0
loc 56
ccs 8
cts 13
cp 0.6153
rs 10
c 0
b 0
f 0
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A setButtonText() 0 4 1
A loadValidatorMetadata() 0 9 1
A getButtonText() 0 3 1
A setButtonClass() 0 4 1
A getButtonClass() 0 3 1
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
 * @ORM\Entity()
17
 */
18
class FeatureStackedItem extends AbstractFeatureItem implements FileInterface
19
{
20
    use FileTrait;
21
22
    /**
23
     * @ORM\Column()
24
     * @Groups({"component", "content"})
25
     * @var null|string
26
     */
27
    protected $buttonText;
28
29
    /**
30
     * @ORM\Column()
31
     * @Groups({"component", "content"})
32
     * @var null|string
33
     */
34
    protected $buttonClass;
35
36
    public static function loadValidatorMetadata(ClassMetadata $metadata)
37
    {
38
        $metadata->addPropertyConstraint(
39
            'description',
40
            new Assert\NotBlank()
41
        );
42
        $metadata->addPropertyConstraint(
43
            'filePath',
44
            new Assert\Image()
45
        );
46 1
    }
47
48 1
    /**
49 1
     * @return null|string
50 1
     */
51
    public function getButtonText(): ?string
52 1
    {
53 1
        return $this->buttonText;
54 1
    }
55
56 1
    public function setButtonText(?string $buttonText): self
57
    {
58
        $this->buttonText = $buttonText;
59
        return $this;
60
    }
61
62
    /**
63
     * @return null|string
64
     */
65
    public function getButtonClass(): ?string
66
    {
67
        return $this->buttonClass;
68
    }
69
70
    public function setButtonClass(?string $buttonClass): self
71
    {
72
        $this->buttonClass = $buttonClass;
73
        return $this;
74
    }
75
}
76