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 — supported-php-versions ( b1e0a1...542ebe )
by
unknown
06:40
created

Helpers   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 73.32%

Importance

Changes 0
Metric Value
wmc 7
lcom 0
cbo 2
dl 0
loc 39
ccs 11
cts 15
cp 0.7332
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
B parseLoginData() 0 20 6
1
<?php
2
3
namespace Skautis;
4
5
/**
6
 * @author Petr Morávek <[email protected]>
7
 */
8
final class Helpers
9
{
10
11
    /**
12
     * @throws StaticClassException
13
     */
14
    final public function __construct()
15
    {
16
        throw new StaticClassException;
17
    }
18
19
    /**
20
     * Parsuje pole dat zaslaných skautISem (například $_SESSION)
21
     *
22
     * @param array $data
23
     * @return array
24
     * @throws UnexpectedValueException pokud se nepodaří naparsovat datum
25
     */
26 1
    public static function parseLoginData(array $data)
27
    {
28 1
        $loginData = [];
29 1
        $loginData[User::ID_LOGIN] = isset($data['skautIS_Token']) ? $data['skautIS_Token'] : null;
30 1
        $loginData[User::ID_ROLE] = isset($data['skautIS_IDRole']) ? (int) $data['skautIS_IDRole'] : null;
31 1
        $loginData[User::ID_UNIT] = isset($data['skautIS_IDUnit']) ? (int) $data['skautIS_IDUnit'] : null;
32
33 1
        if (isset($data['skautIS_DateLogout'])) {
34 1
            $tz = new \DateTimeZone('Europe/Prague');
35 1
            $logoutDate = \DateTime::createFromFormat('j. n. Y H:i:s', $data['skautIS_DateLogout'], $tz);
36 1
            if ($logoutDate === false) {
37
                throw new UnexpectedValueException("Could not parse logout date '{$data['skautIS_DateLogout']}'.");
38
            }
39 1
            $loginData[User::LOGOUT_DATE] = $logoutDate;
40
        } else {
41
            $loginData[User::LOGOUT_DATE] = null;
42
        }
43
44 1
        return $loginData;
45
    }
46
}
47