Passed
Push — master ( 1515b4...79261d )
by Kevin
05:02
created

Comment   A

Complexity

Total Complexity 8

Size/Duplication

Total Lines 70
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 8
eloc 18
c 1
b 0
f 0
dl 0
loc 70
rs 10

8 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getApproved() 0 3 1
A getCreatedAt() 0 3 1
A setBody() 0 5 1
A getBody() 0 3 1
A getUser() 0 3 1
A setApproved() 0 5 1
A setCreatedAt() 0 5 1
1
<?php
2
3
namespace Zenstruck\Foundry\Tests\Fixtures\Document;
4
5
use Doctrine\ODM\MongoDB\Mapping\Annotations as MongoDB;
6
7
/**
8
 * @MongoDB\EmbeddedDocument
9
 */
10
class Comment
11
{
12
    /**
13
     * @MongoDB\EmbedOne(
14
     *     targetDocument=User::class
15
     * )
16
     */
17
    private $user;
18
19
    /**
20
     * @MongoDB\Field(type="string")
21
     */
22
    private $body;
23
24
    /**
25
     * @MongoDB\Field(type="date")
26
     */
27
    private $createdAt;
28
29
    /**
30
     * @MongoDB\Field(type="boolean")
31
     */
32
    private $approved = false;
33
34
    public function __construct(User $user, string $body)
35
    {
36
        $this->user = $user;
37
        $this->body = $body;
38
        $this->createdAt = new \DateTime('now');
39
    }
40
41
    public function getUser(): User
42
    {
43
        return $this->user;
44
    }
45
46
    public function getBody(): ?string
47
    {
48
        return $this->body;
49
    }
50
51
    public function setBody(string $body): self
52
    {
53
        $this->body = $body;
54
55
        return $this;
56
    }
57
58
    public function getCreatedAt(): ?\DateTimeInterface
59
    {
60
        return $this->createdAt;
61
    }
62
63
    public function setCreatedAt(\DateTimeInterface $createdAt): self
64
    {
65
        $this->createdAt = $createdAt;
66
67
        return $this;
68
    }
69
70
    public function getApproved(): bool
71
    {
72
        return $this->approved;
73
    }
74
75
    public function setApproved(bool $approved): self
76
    {
77
        $this->approved = $approved;
78
79
        return $this;
80
    }
81
}
82