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
Pull Request — 2.x (#64)
by Jindřich
07:10
created

HelperTrait   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 45
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 5

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 2
c 0
b 0
f 0
lcom 1
cbo 5
dl 0
loc 45
ccs 0
cts 15
cp 0
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A getInstance() 0 20 2
1
<?php
2
3
namespace Skautis;
4
5
use Skautis\Wsdl\WsdlManager;
6
use Skautis\Wsdl\WebServiceFactory;
7
use Skautis\SessionAdapter\SessionAdapter;
8
9
trait HelperTrait
10
{
11
12
    /**
13
     * sigleton
14
     * @var Skautis[]
15
     */
16
    private static $instances = [];
17
18
19
20
    /**
21
     * Ziska sdilenou instanci Skautis objektu
22
     *
23
     * Ano vime ze to neni officialni pattern
24
     * Jedna se o kockopsa Mezi singletonem a StaticFactory
25
     * Factory metoda na stride kterou instantizuje a novy objekt vytvari jen 1x za beh
26
     * Proc to tak je? Ohled na zpetnou kompatibilitu a out of the box pouzitelnost pro amatery
27
     *
28
     * @var string $appId nastavení appId (nepovinné)
29
     * @var bool $testMode funguje v testovacím provozu? - výchozí je testovací mode (nepovinné)
30
     *
31
     * @return Skautis Sdilena instance Skautis knihovny pro cely beh PHP skriptu
32
     */
33
    public static function getInstance($appId, $testMode = false, $cache = false, $compression = false)
34
    {
35
        if (!isset(self::$instances[$appId])) {
36
            $config = new Config($appId);
37
            $config->setTestMode($testMode);
38
            $config->setCache($cache);
39
            $config->setCompression($compression);
40
41
            $webServiceFactory = new WebServiceFactory();
42
            $wsdlManager = new WsdlManager($webServiceFactory, $config);
43
44
            // Out of box integrace s $_SESSION
45
            $sessionAdapter = new SessionAdapter();
46
            $user = new User($wsdlManager, $sessionAdapter);
47
48
            self::$instances[$appId] = new self($wsdlManager, $user);
49
        }
50
51
        return self::$instances[$appId];
52
    }
53
}
54