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 ( bf4402...8854eb )
by François
07:55
created

Utils   A

Complexity

Total Complexity 10

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 10
lcom 0
cbo 0
dl 0
loc 28
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
B getProcessCount() 0 20 10
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
class Utils
21
{
22
    /**
23
     * Depending on the size of the prefix assigned to this pool, this method
24
     * will return the number of OpenVPN processes backing that range, each
25
     * pool range is split in #processCount number of OpenVPN processes.
26
     */
27
    public static function getProcessCount($prefix)
28
    {
29
        switch ($prefix) {
30
            case 32:    // 1 IP
31
            case 31:    // 2 IPs
32
                throw new RuntimeException('not enough available IPs in range');
33
            case 30:    // 4 IPs (1 usable for client, no splitting)
34
            case 29:    // 8 IPs (5 usable for clients, no splitting)
35
                return 1;
36
            case 28:    // 16 IPs (12 usable for clients)
0 ignored issues
show
Unused Code Comprehensibility introduced by
36% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
37
            case 27:    // 32 IPs
38
            case 26:    // 64 IPs
39
            case 25:    // 128 IPs
40
                return 2;
41
            case 24:
42
                return 4;
43
        }
44
45
        return 8;
46
    }
47
}
48