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.
Completed
Push — master ( cc1a00...2cee89 )
by Christian
15:25
created

Session::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 7
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 5
nc 1
nop 4
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * (c) Christian Gripp <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Core23\FacebookBundle\Session;
13
14
use Facebook\Authentication\AccessToken;
15
use Facebook\GraphNodes\GraphUser;
16
17
final class Session implements SessionInterface
18
{
19
    /**
20
     * @var string
21
     */
22
    private $facebookId;
23
24
    /**
25
     * @var string
26
     */
27
    private $name;
28
29
    /**
30
     * @var string
31
     */
32
    private $token;
33
34
    /**
35
     * @var \DateTime|null
36
     */
37
    private $expireDate;
38
39
    /**
40
     * Session constructor.
41
     *
42
     * @param string         $facebookId
43
     * @param string         $name
44
     * @param string         $token
45
     * @param \DateTime|null $expireDate
46
     */
47
    public function __construct(string $facebookId, string $name, string $token, ?\DateTime $expireDate)
48
    {
49
        $this->facebookId = $facebookId;
50
        $this->name       = $name;
51
        $this->token      = $token;
52
        $this->expireDate = $expireDate;
53
    }
54
55
    /**
56
     * {@inheritdoc}
57
     */
58
    public function getFacebookId(): string
59
    {
60
        return $this->facebookId;
61
    }
62
63
    /**
64
     * {@inheritdoc}
65
     */
66
    public function getName(): string
67
    {
68
        return $this->name;
69
    }
70
71
    /**
72
     * {@inheritdoc}
73
     */
74
    public function getToken(): string
75
    {
76
        return $this->token;
77
    }
78
79
    /**
80
     * {@inheritdoc}
81
     */
82
    public function getExpireDate(): ?\DateTime
83
    {
84
        return $this->expireDate;
85
    }
86
87
    /**
88
     * @param AccessToken $token
89
     * @param GraphUser   $graphUser
90
     *
91
     * @return SessionInterface
92
     */
93
    public static function fromFacebookApi(AccessToken $token, GraphUser $graphUser): SessionInterface
94
    {
95
        return new self($graphUser->getId(), $graphUser->getName(), $token->getValue(), $token->getExpiresAt());
96
    }
97
}
98