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 — 3.x ( 854d93...81f322 )
by Jindřich
01:52
created

HelperTrait   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 50
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 6

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 6
dl 0
loc 50
ccs 13
cts 13
cp 1
rs 10
c 0
b 0
f 0

1 Method

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