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.

Article::getChannels()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
c 0
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Odiseo\SyliusBlogPlugin\Entity;
6
7
use Doctrine\Common\Collections\ArrayCollection;
8
use Doctrine\Common\Collections\Collection;
9
use Odiseo\BlogBundle\Model\Article as BaseArticle;
10
use Sylius\Component\Channel\Model\ChannelInterface;
11
use Sylius\Component\Core\Model\AdminUserInterface;
12
13
class Article extends BaseArticle implements ArticleInterface
14
{
15
    /** @var AdminUserInterface|null */
16
    protected $author;
17
18
    /**
19
     * @var Collection|ChannelInterface[]
20
     *
21
     * @psalm-var Collection<array-key, ChannelInterface>
22
     */
23
    protected $channels;
24
25
    public function __construct()
26
    {
27
        parent::__construct();
28
29
        $this->channels = new ArrayCollection();
30
    }
31
32
    /**
33
     * @inheritdoc
34
     */
35
    public function getAuthor(): ?AdminUserInterface
36
    {
37
        return $this->author;
38
    }
39
40
    /**
41
     * @inheritdoc
42
     */
43
    public function setAuthor(?AdminUserInterface $author): void
44
    {
45
        $this->author = $author;
46
    }
47
48
    /**
49
     * @inheritdoc
50
     */
51
    public function getChannels(): Collection
52
    {
53
        return $this->channels;
54
    }
55
56
    /**
57
     * @inheritdoc
58
     */
59
    public function hasChannel(ChannelInterface $channel): bool
60
    {
61
        return $this->channels->contains($channel);
62
    }
63
64
    /**
65
     * @inheritdoc
66
     */
67
    public function addChannel(ChannelInterface $channel): void
68
    {
69
        if (!$this->hasChannel($channel)) {
70
            $this->channels->add($channel);
71
        }
72
    }
73
74
    /**
75
     * @inheritdoc
76
     */
77
    public function removeChannel(ChannelInterface $channel): void
78
    {
79
        if ($this->hasChannel($channel)) {
80
            $this->channels->removeElement($channel);
81
        }
82
    }
83
}
84