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 ( 8c1a57...b752ac )
by François
02:49
created

InfoModule::init()   A

Complexity

Conditions 2
Paths 1

Size

Total Lines 17
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 17
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 10
nc 1
nop 1
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\Api;
19
20
use SURFnet\VPN\Server\InstanceConfig;
21
use SURFnet\VPN\Server\PoolConfig;
22
use SURFnet\VPN\Common\Http\ServiceModuleInterface;
23
use SURFnet\VPN\Common\Http\Service;
24
use SURFnet\VPN\Common\Http\ApiResponse;
25
use SURFnet\VPN\Common\Http\Request;
26
27
class InfoModule implements ServiceModuleInterface
28
{
29
    /** @var \SURFnet\VPN\Server\InstanceConfig */
30
    private $instanceConfig;
31
32
    public function __construct(InstanceConfig $instanceConfig)
33
    {
34
        $this->instanceConfig = $instanceConfig;
35
    }
36
37
    public function init(Service $service)
38
    {
39
        $service->get(
40
            '/server_pools',
41
            function (Request $request, array $hookData) {
42
                Utils::requireUser($hookData, ['vpn-admin-portal', 'vpn-user-portal']);
43
44
                $responseData = [];
45
                foreach (array_keys($this->instanceConfig->v('vpnPools')) as $poolId) {
46
                    $poolConfig = new PoolConfig($this->instanceConfig->v('vpnPools', $poolId));
47
                    $responseData[$poolId] = $poolConfig->v();
48
                }
49
50
                return new ApiResponse('server_pools', $responseData);
51
            }
52
        );
53
54
        $service->get(
55
            '/server_pool',
56
            function (Request $request, array $hookData) {
57
                Utils::requireUser($hookData, ['vpn-admin-portal', 'vpn-user-portal']);
58
                $poolId = $request->getQueryParameter('pool_id');
59
                InputValidation::poolId($poolId);
60
61
                return new ApiResponse('server_pool', $this->instanceConfig->v('vpnPools', $poolId));
62
            }
63
    }
0 ignored issues
show
Bug introduced by
This code did not parse for me. Apparently, there is an error somewhere around this line:

Syntax error, unexpected '}', expecting ',' or ')'
Loading history...
64
}
65