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

MetaPost   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 48
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 7
c 0
b 0
f 0
lcom 1
cbo 1
dl 0
loc 48
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A getPost() 0 4 1
A setPost() 0 4 1
A getComments() 0 4 1
A setComments() 0 4 1
A isValid() 0 8 3
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
}