Passed
Push — main ( 79e4f1...ed1bb6 )
by Slawomir
04:28
created

CommentPostHeader   A

Complexity

Total Complexity 10

Size/Duplication

Total Lines 98
Duplicated Lines 0 %

Test Coverage

Coverage 60%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 24
c 1
b 0
f 0
dl 0
loc 98
ccs 12
cts 20
cp 0.6
rs 10
wmc 10

10 Methods

Rating   Name   Duplication   Size   Complexity  
A getId() 0 3 1
A setTitle() 0 3 1
A getTitle() 0 3 1
A getComments() 0 3 1
A setTags() 0 3 1
A setComments() 0 3 1
A getTags() 0 3 1
A getVersion() 0 3 1
A setId() 0 3 1
A setVersion() 0 3 1
1
<?php
2
3
namespace App\Modules\Comments\Persistence\Doctrine\Entity;
4
5
use Doctrine\Common\Collections\Collection;
6
use Doctrine\ORM\Mapping as ORM;
7
use Symfony\Component\Uid\Ulid;
8
9
#[ORM\Entity]
10
#[ORM\Table(name: "POST_HEADERS")]
11
class CommentPostHeader
12
{
13
    #[ORM\Id]
14
    #[ORM\Column(type: "ulid", unique: true)]
15
    private Ulid $id;
16
17
    #[ORM\Column(type: "string")]
18
    private string $title;
19
20
    #[ORM\Column(type: "json")]
21
    private array $tags = [];
22
23
    #[ORM\Column(type: "integer")]
24
    private int $version;
25
26
    #[ORM\OneToMany(mappedBy: 'post', targetEntity: Comment::class)]
27
    private Collection $comments;
28
29
    /**
30
     * @return Ulid
31
     */
32
    public function getId(): Ulid
33
    {
34
        return $this->id;
35
    }
36
37
    /**
38
     * @param Ulid $id
39
     */
40
    public function setId(Ulid $id): void
41
    {
42
        $this->id = $id;
43
    }
44
45
    /**
46
     * @return string
47
     */
48
    public function getTitle(): string
49
    {
50
        return $this->title;
51
    }
52
53
    /**
54
     * @param string $title
55 3
     */
56
    public function setTitle(string $title): void
57 3
    {
58 3
        $this->title = $title;
59
    }
60
61
    /**
62
     * @return array
63
     */
64
    public function getTags(): array
65
    {
66
        return $this->tags;
67
    }
68
69
    /**
70
     * @param array $tags
71 3
     */
72
    public function setTags(array $tags): void
73 3
    {
74 3
        $this->tags = $tags;
75
    }
76
77
    /**
78
     * @return int
79
     */
80
    public function getVersion(): int
81
    {
82
        return $this->version;
83
    }
84
85
    /**
86
     * @param int $version
87 3
     */
88
    public function setVersion(int $version): void
89 3
    {
90 3
        $this->version = $version;
91
    }
92
93
    /**
94
     * @return Collection
95
     */
96
    public function getComments(): Collection
97
    {
98
        return $this->comments;
99
    }
100
101
    /**
102
     * @param Collection $comments
103 3
     */
104
    public function setComments(Collection $comments): void
105 3
    {
106 3
        $this->comments = $comments;
107
    }
108
}