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 — 3.x ( 52ff30...48a2e9 )
by Jindřich
12s queued 11s
created

Helpers::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 3
ccs 0
cts 2
cp 0
crap 2
rs 10
c 0
b 0
f 0
1
<?php
2
declare(strict_types = 1);
3
4
namespace Skaut\Skautis;
5
6
use DateTime;
7
use DateTimeZone;
8
9
/**
10
 * @author Petr Morávek <[email protected]>
11
 */
12
final class Helpers
13
{
14
15
    final private function __construct()
16
    {
17
    }
18
19
    /**
20
     * Parsuje pole dat zaslaných skautISem (například $_SESSION)
21
     *
22
     * @param array<string, mixed> $data
23
     *
24
     * @return array<string, mixed>
0 ignored issues
show
Documentation introduced by
The doc-type array<string, could not be parsed: Expected ">" at position 5, but found "end of type". (view supported doc-types)

This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types.

Loading history...
25
     *
26
     * @throws UnexpectedValueException pokud se nepodaří naparsovat datum
27
     */
28 1
    public static function parseLoginData(array $data): array
29
    {
30 1
        $loginData = [];
31 1
        $loginData[User::ID_LOGIN] = isset($data['skautIS_Token']) ? (string)$data['skautIS_Token'] : null;
32 1
        $loginData[User::ID_ROLE] = isset($data['skautIS_IDRole']) ? (int) $data['skautIS_IDRole'] : null;
33 1
        $loginData[User::ID_UNIT] = isset($data['skautIS_IDUnit']) ? (int) $data['skautIS_IDUnit'] : null;
34
35 1
        if (isset($data['skautIS_DateLogout'])) {
36 1
            $tz = new DateTimeZone('Europe/Prague');
37 1
            $logoutDate = DateTime::createFromFormat('j. n. Y H:i:s', $data['skautIS_DateLogout'], $tz);
38 1
            if ($logoutDate === false) {
39
                throw new UnexpectedValueException("Could not parse logout date '{$data['skautIS_DateLogout']}'.");
40
            }
41 1
            $loginData[User::LOGOUT_DATE] = $logoutDate;
42
        } else {
43
            $loginData[User::LOGOUT_DATE] = null;
44
        }
45
46 1
        return $loginData;
47
    }
48
}
49