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
Branch v2 (b7a21f)
by Oliver
06:19 queued 03:39
created

Manager::resolve()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 2
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
namespace TYPO3\PharStreamWrapper;
3
4
/*
5
 * This file is part of the TYPO3 project.
6
 *
7
 * It is free software; you can redistribute it and/or modify it under the terms
8
 * of the MIT License (MIT). For the full copyright and license information,
9
 * please read the LICENSE file that was distributed with this source code.
10
 *
11
 * The TYPO3 project - inspiring people to share!
12
 */
13
14
use TYPO3\PharStreamWrapper\Resolver\PharInvocation;
15
use TYPO3\PharStreamWrapper\Resolver\PharInvocationCollection;
16
use TYPO3\PharStreamWrapper\Resolver\PharInvocationResolver;
17
18
class Manager
19
{
20
    /**
21
     * @var self
22
     */
23
    private static $instance;
24
25
    /**
26
     * @var Behavior
27
     */
28
    private $behavior;
29
30
    /**
31
     * @var Resolvable
32
     */
33
    private $resolver;
34
35
    /**
36
     * @var Collectable
37
     */
38
    private $collection;
39
40
    /**
41
     * @param Behavior $behaviour
42
     * @param Resolvable $resolver
43
     * @param Collectable $collection
44
     * @return self
45
     */
46
    public static function initialize(
47
        Behavior $behaviour,
48
        Resolvable $resolver = null,
49
        Collectable $collection = null
50
    ) {
51
        if (self::$instance === null) {
52
            self::$instance = new self($behaviour, $resolver, $collection);
53
            return self::$instance;
54
        }
55
        throw new \LogicException(
56
            'Manager can only be initialized once',
57
            1535189871
58
        );
59
    }
60
61
    /**
62
     * @return self
63
     */
64
    public static function instance()
65
    {
66
        if (self::$instance !== null) {
67
            return self::$instance;
68
        }
69
        throw new \LogicException(
70
            'Manager needs to be initialized first',
71
            1535189872
72
        );
73
    }
74
75
    /**
76
     * @return bool
77
     */
78
    public static function destroy()
79
    {
80
        if (self::$instance === null) {
81
            return false;
82
        }
83
        self::$instance = null;
84
        return true;
85
    }
86
87
    /**
88
     * @param Behavior $behaviour
89
     * @param Resolvable $resolver
90
     * @param Collectable $collection
91
     */
92
    private function __construct(
93
        Behavior $behaviour,
94
        Resolvable $resolver = null,
95
        Collectable $collection = null
96
    ) {
97
        if ($collection === null) {
98
            $collection = new PharInvocationCollection();
99
        }
100
        if ($resolver === null) {
101
            $resolver = new PharInvocationResolver();
102
        }
103
        $this->collection = $collection;
104
        $this->resolver = $resolver;
105
        $this->behavior = $behaviour;
106
    }
107
108
    /**
109
     * @param string $path
110
     * @param string $command
111
     * @return bool
112
     */
113
    public function assert($path, $command)
114
    {
115
        return $this->behavior->assert($path, $command);
116
    }
117
118
    /**
119
     * @param string $path
120
     * @param null|int $flags
121
     * @return null|PharInvocation
122
     */
123
    public function resolve($path, $flags = null)
124
    {
125
        return $this->resolver->resolve($path, $flags);
126
    }
127
128
    /**
129
     * @return Collectable
130
     */
131
    public function getCollection()
132
    {
133
        return $this->collection;
134
    }
135
}
136