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.

U2fServerGenerator   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 10
dl 0
loc 27
rs 10
c 0
b 0
f 0
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A getServer() 0 11 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace LM\AuthAbstractor\U2f;
6
7
use LM\AuthAbstractor\Configuration\IApplicationConfiguration;
8
use Firehed\U2F\Server;
9
10
/**
11
 * This class is only a factory to create a Firehed Server object.
12
 *
13
 * @internal
14
 */
15
class U2fServerGenerator
16
{
17
    /** @var IApplicationConfiguration */
18
    private $appConfig;
19
20
    /**
21
     * @param IApplicationConfiguration $appConfig
22
     */
23
    public function __construct(IApplicationConfiguration $appConfig)
24
    {
25
        $this->appConfig = $appConfig;
26
    }
27
28
    /**
29
     * @return Server An instance of Firehed server.
30
     */
31
    public function getServer(): Server
32
    {
33
        $server = new Server();
34
        if (null === $this->appConfig->getU2fCertificates()) {
35
            $server->disableCAVerification();
36
        } else {
37
            $server->setTrustedCAs($this->appConfig->getU2fCertificates());
38
        }
39
        $server->setAppId($this->appConfig->getAppId());
40
41
        return $server;
42
    }
43
}
44