GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

ArticleComment   A
last analyzed

Complexity

Total Complexity 19

Size/Duplication

Total Lines 166
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 33
dl 0
loc 166
rs 10
c 1
b 0
f 1
wmc 19

17 Methods

Rating   Name   Duplication   Size   Complexity  
A setArticle() 0 3 1
A hasChildren() 0 3 1
A __construct() 0 5 1
A getName() 0 3 1
A getChildren() 0 3 1
A getArticle() 0 3 1
A getEnabledChildren() 0 4 1
A getId() 0 3 1
A setComment() 0 3 1
A getComment() 0 3 1
A setEmail() 0 3 1
A setName() 0 3 1
A getEmail() 0 3 1
A setParent() 0 3 1
A getParent() 0 3 1
A removeChildren() 0 4 2
A addChildren() 0 5 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Odiseo\BlogBundle\Model;
6
7
use DateTime;
8
use Doctrine\Common\Collections\ArrayCollection;
9
use Sylius\Component\Resource\Model\TimestampableTrait;
10
use Sylius\Component\Resource\Model\ToggleableTrait;
11
12
/**
13
 * @author Diego D'amico <[email protected]>
14
 */
15
class ArticleComment implements ArticleCommentInterface
16
{
17
    use TimestampableTrait;
18
    use ToggleableTrait;
19
20
    /** @var integer */
21
    private $id;
22
23
    /** @var string|null */
24
    private $comment;
25
26
    /** @var string|null */
27
    private $name;
28
29
    /** @var string|null */
30
    private $email;
31
32
    /** @var ArticleInterface|null */
33
    protected $article;
34
35
    /** @var ArrayCollection|ArticleCommentInterface[]  */
36
    protected $children;
37
38
    /** @var ArticleCommentInterface|null */
39
    protected $parent;
40
41
    public function __construct()
42
    {
43
        $this->enabled = false;
44
        $this->children = new ArrayCollection();
45
        $this->createdAt = new DateTime();
46
    }
47
48
    /**
49
     * {@inheritdoc}
50
     */
51
    public function getId()
52
    {
53
        return $this->id;
54
    }
55
56
    /**
57
     * {@inheritdoc}
58
     */
59
    public function getComment(): ?string
60
    {
61
        return $this->comment;
62
    }
63
64
    /**
65
     * {@inheritdoc}
66
     */
67
    public function setComment(?string $comment): void
68
    {
69
        $this->comment = $comment;
70
    }
71
72
    /**
73
     * {@inheritdoc}
74
     */
75
    public function getName(): ?string
76
    {
77
        return $this->name;
78
    }
79
80
    /**
81
     * {@inheritdoc}
82
     */
83
    public function setName(?string $name): void
84
    {
85
        $this->name = $name;
86
    }
87
88
    /**
89
     * {@inheritdoc}
90
     */
91
    public function getEmail(): ?string
92
    {
93
        return $this->email;
94
    }
95
96
    /**
97
     * {@inheritdoc}
98
     */
99
    public function setEmail(?string $email): void
100
    {
101
        $this->email = $email;
102
    }
103
104
    /**
105
     * {@inheritdoc}
106
     */
107
    public function getArticle(): ?ArticleInterface
108
    {
109
        return $this->article;
110
    }
111
112
    /**
113
     * {@inheritdoc}
114
     */
115
    public function setArticle(?ArticleInterface $article): void
116
    {
117
        $this->article = $article;
118
    }
119
120
    /**
121
     * {@inheritdoc}
122
     */
123
    public function getChildren(): iterable
124
    {
125
        return $this->children;
126
    }
127
128
    /**
129
     * {@inheritdoc}
130
     */
131
    public function getEnabledChildren(): iterable
132
    {
133
        return $this->children->filter(function(ArticleCommentInterface $comment) {
134
            return $comment->isEnabled();
135
        });
136
    }
137
138
    /**
139
     * {@inheritdoc}
140
     */
141
    public function hasChildren(ArticleCommentInterface $comment): bool
142
    {
143
        return $this->children->contains($comment);
144
    }
145
146
    /**
147
     * {@inheritdoc}
148
     */
149
    public function addChildren(ArticleCommentInterface $comment): void
150
    {
151
        if (!$this->hasChildren($comment)) {
152
            $comment->setParent($this);
153
            $this->children->add($comment);
154
        }
155
    }
156
157
    /**
158
     * {@inheritdoc}
159
     */
160
    public function removeChildren(ArticleCommentInterface $comment): void
161
    {
162
        if ($this->hasChildren($comment)) {
163
            $this->children->removeElement($comment);
164
        }
165
    }
166
167
    /**
168
     * {@inheritdoc}
169
     */
170
    public function getParent(): ?ArticleCommentInterface
171
    {
172
        return $this->parent;
173
    }
174
175
    /**
176
     * {@inheritdoc}
177
     */
178
    public function setParent(?ArticleCommentInterface $parent): void
179
    {
180
        $this->parent = $parent;
181
    }
182
}
183