Test Failed
Push — develop ( fcdffa...038e73 )
by Daniel
10:46
created

Content::setTitle()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 2
dl 0
loc 4
ccs 0
cts 0
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Silverback\ApiComponentBundle\Entity\Component\Content;
6
7
use Doctrine\ORM\Mapping as ORM;
8
use Silverback\ApiComponentBundle\Entity\Component\AbstractComponent;
9
use Symfony\Component\Serializer\Annotation\Groups;
10
use Symfony\Component\Validator\Constraints as Assert;
11
use Symfony\Component\Validator\Mapping\ClassMetadata;
12
13
/**
14
 * Class Content
15
 * @package Silverback\ApiComponentBundle\Entity\Component\Content
16
 * @ORM\Entity()
17
 */
18
class Content extends AbstractComponent
19
{
20
    /**
21
     * @ORM\Column()
22
     * @Groups({"component", "content"})
23
     * @var null|string
24
     */
25
    protected $title;
26
27 1
    /**
28
     * @ORM\Column(type="text")
29 1
     * @Groups({"content", "component"})
30 1
     * @var string
31 1
     */
32
    private $content;
33 1
34
    public static function loadValidatorMetadata(ClassMetadata $metadata): void
35
    {
36
        $metadata->addPropertyConstraint(
37
            'content',
38
            new Assert\NotNull()
39
        );
40
    }
41
42
    /**
43
     * @return string
44
     */
45
    public function getContent(): string
46
    {
47
        return $this->content;
48
    }
49
50
    public function setContent(string $content): self
51
    {
52
        $this->content = $content;
53
        return $this;
54
    }
55
56
    /**
57
     * @return null|string
58
     */
59
    public function getTitle(): ?string
60
    {
61
        return $this->title;
62
    }
63
64
    public function setTitle(?string $title): self
65
    {
66
        $this->title = $title;
67
        return $this;
68
    }
69
}
70