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::setAuthor()   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 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Odiseo\SyliusBlogPlugin\Entity;
6
7
use Odiseo\BlogBundle\Model\ArticleComment as BaseArticleComment;
8
use Sylius\Component\Core\Model\ShopUserInterface;
9
10
class ArticleComment extends BaseArticleComment implements ArticleCommentInterface
11
{
12
    /** @var ShopUserInterface|null */
13
    protected $author;
14
15
    /**
16
     * {@inheritdoc}
17
     */
18
    public function getAuthor(): ?ShopUserInterface
19
    {
20
        return $this->author;
21
    }
22
23
    /**
24
     * {@inheritdoc}
25
     */
26
    public function setAuthor(?ShopUserInterface $author): void
27
    {
28
        $this->author = $author;
29
    }
30
31
    /**
32
     * {@inheritdoc}
33
     */
34
    public function getUsername(): ?string
35
    {
36
        $author = $this->getAuthor();
37
        if ($author instanceof ShopUserInterface) {
38
            return $author->getUsername();
39
        }
40
41
        return $this->getEmail();
42
    }
43
}
44