Test Failed
Push — develop ( 92c10d...ff12cf )
by Daniel
05:05
created

ArticlePage::setSubtitle()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 2
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Silverback\ApiComponentBundle\Entity\Content\Page\Dynamic\ArticlePage;
6
7
use Doctrine\ORM\Mapping as ORM;
8
use Silverback\ApiComponentBundle\Entity\Component\FileInterface;
9
use Silverback\ApiComponentBundle\Entity\Component\FileTrait;
10
use Silverback\ApiComponentBundle\Entity\Content\Page\Dynamic\DynamicContent;
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
 * @ORM\AttributeOverrides({
18
 *      @ORM\AttributeOverride(
19
 *          name="filePath",
20
 *          column=@ORM\Column(
21
 *              nullable=true
22
 *          )
23
 *      )
24
 * })
25
 */
26
final class ArticlePage extends DynamicContent implements FileInterface
27
{
28
    use FileTrait;
29
30
    /**
31
     * @ORM\Column(type="string", nullable=true)
32
     * @Groups({"default"})
33
     * @var null|string
34
     */
35
    private $subtitle;
36
37
    /**
38
     * @ORM\Column(type="text")
39
     * @Groups({"default"})
40
     * @var string
41
     */
42
    private $content = '';
43
44
    /**
45
     * @ORM\Column(type="string", nullable=true)
46
     * @Groups({"default"})
47
     * @var null|string
48
     */
49
    private $imageCaption;
50
51
    public function getSubtitle(): ?string
52
    {
53
        return $this->subtitle;
54
    }
55
56
    public function setSubtitle(?string $subtitle): self
57
    {
58
        $this->subtitle = $subtitle;
59
        return $this;
60
    }
61
62
    public function getContent(): string
63
    {
64
        return $this->content;
65
    }
66
67
    public function setContent(string $content): self
68
    {
69
        $this->content = $content;
70
        return $this;
71
    }
72
73
    public function setImageCaption(string $imageCaption): self
74
    {
75
        $this->imageCaption = $imageCaption;
76
        return $this;
77
    }
78
79
    public function getImageCaption(): ?string
80
    {
81
        return $this->imageCaption;
82
    }
83
84
    public static function loadValidatorMetadata(ClassMetadata $metadata): void
85
    {
86
        $metadata->addPropertyConstraint(
87
            'title',
88
            new Assert\NotNull()
89
        );
90
91
        $metadata->addPropertyConstraint(
92
            'content',
93
            new Assert\NotNull()
94
        );
95
    }
96
}
97