Test Setup Failed
Push — master ( 80a7cc...26b8e4 )
by Alexey
02:49
created

MetaPost::setComments()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
3
namespace Skobkin\Bundle\PointToolsBundle\DTO\Api;
4
5
class MetaPost implements ValidableInterface
6
{
7
    /**
8
     * @var Post|null
9
     */
10
    private $post;
11
12
    /**
13
     * @var Comment[]|null
14
     */
15
    private $comments;
16
17
18
    public function getPost(): ?Post
19
    {
20
        return $this->post;
21
    }
22
23
    public function setPost(?Post $post): void
24
    {
25
        $this->post = $post;
26
    }
27
28
    /**
29
     * @return Comment[]|null
30
     */
31
    public function getComments(): ?array
32
    {
33
        return $this->comments;
34
    }
35
36
    /**
37
     * @param Comment[]|null $comments
38
     */
39
    public function setComments(?array $comments): void
40
    {
41
        $this->comments = $comments;
42
    }
43
44
    public function isValid(): bool
45
    {
46
        if (null !== $this->post && $this->post->isValid()) {
47
            return true;
48
        }
49
50
        return false;
51
    }
52
}