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 ( 932629...d7a7a8 )
by François
03:12
created

TestCa::caCert()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
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
19
namespace SURFnet\VPN\Server\Tests;
20
21
use SURFnet\VPN\Common\Config;
22
use SURFnet\VPN\Server\CA\CaInterface;
23
24
class TestCa implements CaInterface
25
{
26
    /**
27
     * Generate a certificate for the VPN server.
28
     *
29
     * @param string $commonName
30
     *
31
     * @return array the certificate, key in array with keys
32
     *               'cert', 'key', 'valid_from' and 'valid_to'
33
     */
34 View Code Duplication
    public function serverCert($commonName)
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...
35
    {
36
        return [
37
            'certificate' => sprintf('ServerCert for %s', $commonName),
38
            'private_key' => sprintf('ServerCert for %s', $commonName),
39
            'valid_from' => 1234567890,
40
            'valid_to' => 2345678901,
41
        ];
42
    }
43
44
    /**
45
     * Generate a certificate for a VPN client.
46
     *
47
     * @param string $commonName
48
     *
49
     * @return array the certificate and key in array with keys 'cert', 'key',
50
     *               'valid_from' and 'valid_to'
51
     */
52 View Code Duplication
    public function clientCert($commonName)
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
        return [
55
            'certificate' => sprintf('ClientCert for %s', $commonName),
56
            'private_key' => sprintf('ClientKey for %s', $commonName),
57
            'valid_from' => 1234567890,
58
            'valid_to' => 2345678901,
59
        ];
60
    }
61
62
    /**
63
     * Get the CA root certificate.
64
     *
65
     * @return string the CA certificate in PEM format
66
     */
67
    public function caCert()
68
    {
69
        return 'Ca';
70
    }
71
72
    public function init(Config $config)
0 ignored issues
show
Unused Code introduced by
The parameter $config is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
73
    {
74
        // NOP
75
    }
76
}
77