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

Content   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 31
ccs 9
cts 9
cp 1
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A loadValidatorMetadata() 0 5 1
A getContent() 0 3 1
A setContent() 0 3 1
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