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.

TestOAuthClientSession   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
lcom 1
cbo 1
dl 0
loc 34
rs 10
c 1
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A take() 0 10 2
A set() 0 4 1
1
<?php
2
3
/**
4
 * eduVPN - End-user friendly VPN.
5
 *
6
 * Copyright: 2016-2017, The Commons Conservancy eduVPN Programme
7
 * SPDX-License-Identifier: AGPL-3.0+
8
 */
9
10
namespace SURFnet\VPN\Server\Tests;
11
12
use fkooman\OAuth\Client\Exception\SessionException;
13
use fkooman\OAuth\Client\SessionInterface;
14
15
class TestOAuthClientSession implements SessionInterface
16
{
17
    /** @var array */
18
    private $data = [];
19
20
    /**
21
     * Get value, delete key.
22
     *
23
     * @param string $key
24
     *
25
     * @return mixed
26
     */
27
    public function take($key)
28
    {
29
        if (!array_key_exists($key, $this->data)) {
30
            throw new SessionException(sprintf('key "%s" not found in session', $key));
31
        }
32
        $value = $this->data[$key];
33
        unset($this->data[$key]);
34
35
        return $value;
36
    }
37
38
    /**
39
     * Set key to value.
40
     *
41
     * @param string $key
42
     * @param mixed  $value
43
     */
44
    public function set($key, $value)
45
    {
46
        $this->data[$key] = $value;
47
    }
48
}
49