Passed
Pull Request — master (#38)
by Kevin
17:07
created

Comment   A

Complexity

Total Complexity 11

Size/Duplication

Total Lines 99
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 11
eloc 24
c 1
b 0
f 0
dl 0
loc 99
rs 10

11 Methods

Rating   Name   Duplication   Size   Complexity  
A setPost() 0 5 1
A setCreatedAt() 0 5 1
A __construct() 0 5 1
A setBody() 0 5 1
A getUser() 0 3 1
A getApproved() 0 3 1
A getPost() 0 3 1
A setApproved() 0 5 1
A getId() 0 3 1
A getCreatedAt() 0 3 1
A getBody() 0 3 1
1
<?php
2
3
namespace Zenstruck\Foundry\Tests\Fixtures\Entity;
4
5
use Doctrine\ORM\Mapping as ORM;
6
7
/**
8
 * @ORM\Entity
9
 */
10
class Comment
11
{
12
    /**
13
     * @ORM\Id
14
     * @ORM\GeneratedValue
15
     * @ORM\Column(type="integer")
16
     */
17
    private $id;
18
19
    /**
20
     * @ORM\ManyToOne(targetEntity=User::class)
21
     * @ORM\JoinColumn(nullable=false, onDelete="CASCADE")
22
     */
23
    private $user;
24
25
    /**
26
     * @ORM\Column(type="text")
27
     */
28
    private $body;
29
30
    /**
31
     * @ORM\Column(type="datetime")
32
     */
33
    private $createdAt;
34
35
    /**
36
     * @ORM\ManyToOne(targetEntity=Post::class, inversedBy="comments")
37
     * @ORM\JoinColumn(nullable=false, onDelete="CASCADE")
38
     */
39
    private $post;
40
41
    /**
42
     * @ORM\Column(type="boolean")
43
     */
44
    private $approved = false;
45
46
    public function __construct(User $user, string $body)
47
    {
48
        $this->user = $user;
49
        $this->body = $body;
50
        $this->createdAt = new \DateTime('now');
51
    }
52
53
    public function getId(): ?int
54
    {
55
        return $this->id;
56
    }
57
58
    public function getUser(): User
59
    {
60
        return $this->user;
61
    }
62
63
    public function getBody(): ?string
64
    {
65
        return $this->body;
66
    }
67
68
    public function setBody(string $body): self
69
    {
70
        $this->body = $body;
71
72
        return $this;
73
    }
74
75
    public function getCreatedAt(): ?\DateTimeInterface
76
    {
77
        return $this->createdAt;
78
    }
79
80
    public function setCreatedAt(\DateTimeInterface $createdAt): self
81
    {
82
        $this->createdAt = $createdAt;
83
84
        return $this;
85
    }
86
87
    public function getPost(): ?Post
88
    {
89
        return $this->post;
90
    }
91
92
    public function setPost(?Post $post): self
93
    {
94
        $this->post = $post;
95
96
        return $this;
97
    }
98
99
    public function getApproved(): ?bool
100
    {
101
        return $this->approved;
102
    }
103
104
    public function setApproved(bool $approved): self
105
    {
106
        $this->approved = $approved;
107
108
        return $this;
109
    }
110
}
111