Passed
Push — develop ( 1c9254...e0f0df )
by Daniel
04:57
created

Content::getContent()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

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