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 ( 643f2e...8f463a )
by François
02:35
created

InstanceConfig::apiConsumers()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
/**
3
 *  Copyright (C) 2016 SURFnet.
4
 *
5
 *  This program is free software: you can redistribute it and/or modify
6
 *  it under the terms of the GNU Affero General Public License as
7
 *  published by the Free Software Foundation, either version 3 of the
8
 *  License, or (at your option) any later version.
9
 *
10
 *  This program is distributed in the hope that it will be useful,
11
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 *  GNU Affero General Public License for more details.
14
 *
15
 *  You should have received a copy of the GNU Affero General Public License
16
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
17
 */
18
namespace SURFnet\VPN\Server;
19
20
use SURFnet\VPN\Server\Exception\InstanceException;
21
22
/**
23
 * Read the configuration of a particular instance.
24
 */
25
class InstanceConfig extends Config
26
{
27
    /**
28
     * Retrieve a configuration object for a pool.
29
     */
30 View Code Duplication
    public function pool($poolId)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
31
    {
32
        if (!in_array($poolId, $this->pools())) {
33
            throw new InstanceException(sprintf('pool "%s" not found', $poolId));
34
        }
35
36
        return new PoolConfig($this->configData['vpnPools'][$poolId]);
37
    }
38
39
    /**
40
     * Retrieve a list of all pools.
41
     */
42
    public function pools()
43
    {
44
        return array_keys($this->v('vpnPools', []));
45
    }
46
47
    public function groupProviders()
48
    {
49
        return array_keys($this->v('groupProviders', []));
50
    }
51
52 View Code Duplication
    public function groupProvider($groupProviderId)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
53
    {
54
        if (!in_array($groupProviderId, $this->groupProviders())) {
55
            throw new InstanceException(sprintf('group provider "%s" not found', $groupProviderId));
56
        }
57
58
        return $this->configData['groupProviders'][$groupProviderId];
59
    }
60
61
    public function apiConsumers()
62
    {
63
        return $this->v('apiConsumers');
64
    }
65
66
    public function instanceNumber()
67
    {
68
        return $this->v('instanceNumber');
69
    }
70
}
71