Passed
Pull Request — master (#153)
by Kevin
03:19
created

Comment   A

Complexity

Total Complexity 8

Size/Duplication

Total Lines 68
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 68
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\Field(type="string")
14
     */
15
    private $user;
16
17
    /**
18
     * @MongoDB\Field(type="string")
19
     */
20
    private $body;
21
22
    /**
23
     * @MongoDB\Field(type="date")
24
     */
25
    private $createdAt;
26
27
    /**
28
     * @MongoDB\Field(type="boolean")
29
     */
30
    private $approved = false;
31
32
    public function __construct(string $user, string $body)
33
    {
34
        $this->user = $user;
35
        $this->body = $body;
36
        $this->createdAt = new \DateTime('now');
37
    }
38
39
    public function getUser(): string
40
    {
41
        return $this->user;
42
    }
43
44
    public function getBody(): ?string
45
    {
46
        return $this->body;
47
    }
48
49
    public function setBody(string $body): self
50
    {
51
        $this->body = $body;
52
53
        return $this;
54
    }
55
56
    public function getCreatedAt(): ?\DateTimeInterface
57
    {
58
        return $this->createdAt;
59
    }
60
61
    public function setCreatedAt(\DateTimeInterface $createdAt): self
62
    {
63
        $this->createdAt = $createdAt;
64
65
        return $this;
66
    }
67
68
    public function getApproved(): bool
69
    {
70
        return $this->approved;
71
    }
72
73
    public function setApproved(bool $approved): self
74
    {
75
        $this->approved = $approved;
76
77
        return $this;
78
    }
79
}
80