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 ( 1f83af...994fb5 )
by Cees-Jan
04:40
created

ApiSettings::getVersion()   A

Complexity

Conditions 3
Paths 4

Size

Total Lines 14
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 7
CRAP Score 3

Importance

Changes 0
Metric Value
dl 0
loc 14
ccs 7
cts 7
cp 1
rs 9.4285
c 0
b 0
f 0
cc 3
eloc 7
nc 4
nop 1
crap 3
1
<?php declare(strict_types=1);
2
3
namespace ApiClients\Client\Pusher;
4
5
use PackageVersions\Versions;
6
7
final class ApiSettings
8
{
9
    /**
10
     * Create Pusher compatible version
11
     *
12
     * @param string $version
13
     * @return string
14
     */
15 4
    public static function getVersion(string $version = ''): string
16
    {
17 4
        if ($version === '') {
18 2
            $version = Versions::getVersion('api-clients/pusher');
19
        }
20
21 4
        list($version, $hash) = explode('@', $version);
22
23 4
        if (substr($version, -4) === '-dev') {
24 1
            return '0.0.1-' . $hash;
25
        }
26
27 3
        return $version;
28
    }
29
30
    /**
31
     * Create WebSocket URL for given App ID
32
     *
33
     * @param string $appId
34
     * @return string
35
     */
36 1
    public static function createUrl(string $appId): string
37
    {
38
        $query = [
39 1
            'client' => 'api-clients/pusher (https://php-api-clients.org/clients/pusher)',
40 1
            'protocol' => 7,
41 1
            'version' => ApiSettings::getVersion(),
42
        ];
43
44
        return 'wss://ws.pusherapp.com/app/' .
45 1
            $appId .
46 1
            '?' . http_build_query($query)
47
        ;
48
    }
49
}
50