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

SessionManager::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
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 Core23\FacebookBundle\Session\Session as FacebookSession;
15
use Symfony\Component\HttpFoundation\Session\Session;
0 ignored issues
show
Bug introduced by
This use statement conflicts with another class in this namespace, Core23\FacebookBundle\Session\Session.

Let’s assume that you have a directory layout like this:

.
|-- OtherDir
|   |-- Bar.php
|   `-- Foo.php
`-- SomeDir
    `-- Foo.php

and let’s assume the following content of Bar.php:

// Bar.php
namespace OtherDir;

use SomeDir\Foo; // This now conflicts the class OtherDir\Foo

If both files OtherDir/Foo.php and SomeDir/Foo.php are loaded in the same runtime, you will see a PHP error such as the following:

PHP Fatal error:  Cannot use SomeDir\Foo as Foo because the name is already in use in OtherDir/Foo.php

However, as OtherDir/Foo.php does not necessarily have to be loaded and the error is only triggered if it is loaded before OtherDir/Bar.php, this problem might go unnoticed for a while. In order to prevent this error from surfacing, you must import the namespace with a different alias:

// Bar.php
namespace OtherDir;

use SomeDir\Foo as SomeDirFoo; // There is no conflict anymore.
Loading history...
16
17
final class SessionManager implements SessionManagerInterface
18
{
19
    private const SESSION_FB_EXPIRES = '_CORE23_FACEBOOK_EXPIRES';
20
21
    private const SESSION_FB_NAME    = '_CORE23_FACEBOOK_NAME';
22
23
    private const SESSION_FB_ID      = '_CORE23_FACEBOOK_ID';
24
25
    private const SESSION_FB_TOKEN   = '_CORE23_FACEBOOK_TOKEN';
26
27
    /**
28
     * @var SessionInterface
29
     */
30
    private $session;
31
32
    /**
33
     * AbstractAuthAction constructor.
34
     *
35
     * @param Session $session
36
     */
37
    public function __construct(Session $session)
38
    {
39
        $this->session = $session;
0 ignored issues
show
Documentation Bug introduced by
It seems like $session of type object<Symfony\Component...dation\Session\Session> is incompatible with the declared type object<Core23\FacebookBu...ssion\SessionInterface> of property $session.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
40
    }
41
42
    /**
43
     * {@inheritdoc}
44
     */
45
    public function isAuthenticated(): bool
46
    {
47
        return (bool) $this->session->get(static::SESSION_FB_TOKEN);
0 ignored issues
show
Bug introduced by
The method get() does not seem to exist on object<Core23\FacebookBu...ssion\SessionInterface>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
48
    }
49
50
    /**
51
     * {@inheritdoc}
52
     */
53
    public function getUsername(): ?string
54
    {
55
        return $this->session->get(static::SESSION_FB_NAME);
0 ignored issues
show
Bug introduced by
The method get() does not seem to exist on object<Core23\FacebookBu...ssion\SessionInterface>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
56
    }
57
58
    /**
59
     * {@inheritdoc}
60
     */
61
    public function store(SessionInterface $session): void
62
    {
63
        $this->session->set(static::SESSION_FB_ID, $session->getFacebookId());
0 ignored issues
show
Bug introduced by
The method set() does not seem to exist on object<Core23\FacebookBu...ssion\SessionInterface>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
64
        $this->session->set(static::SESSION_FB_NAME, $session->getName());
0 ignored issues
show
Bug introduced by
The method set() does not seem to exist on object<Core23\FacebookBu...ssion\SessionInterface>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
65
        $this->session->set(static::SESSION_FB_TOKEN, $session->getToken());
0 ignored issues
show
Bug introduced by
The method set() does not seem to exist on object<Core23\FacebookBu...ssion\SessionInterface>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
66
        $this->session->set(static::SESSION_FB_EXPIRES, $session->getExpireDate());
0 ignored issues
show
Bug introduced by
The method set() does not seem to exist on object<Core23\FacebookBu...ssion\SessionInterface>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
67
    }
68
69
    /**
70
     * {@inheritdoc}
71
     */
72
    public function getSession(): ?SessionInterface
73
    {
74
        if (!$this->isAuthenticated()) {
75
            return null;
76
        }
77
78
        return new FacebookSession(
79
            $this->session->get(static::SESSION_FB_ID),
0 ignored issues
show
Bug introduced by
The method get() does not seem to exist on object<Core23\FacebookBu...ssion\SessionInterface>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
80
            $this->session->get(static::SESSION_FB_NAME),
0 ignored issues
show
Bug introduced by
The method get() does not seem to exist on object<Core23\FacebookBu...ssion\SessionInterface>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
81
            $this->session->get(static::SESSION_FB_TOKEN),
0 ignored issues
show
Bug introduced by
The method get() does not seem to exist on object<Core23\FacebookBu...ssion\SessionInterface>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
82
            $this->session->get(static::SESSION_FB_EXPIRES)
0 ignored issues
show
Bug introduced by
The method get() does not seem to exist on object<Core23\FacebookBu...ssion\SessionInterface>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
83
        );
84
    }
85
}
86