Passed
Pull Request — master (#1)
by
unknown
06:09
created

RefreshResponse   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 48
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 13
dl 0
loc 48
ccs 14
cts 14
cp 1
rs 10
c 0
b 0
f 0
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A getAccessToken() 0 2 1
A getUser() 0 2 1
A getClientToken() 0 2 1
A __construct() 0 10 1
A getSelectedProfile() 0 2 1
1
<?php
2
declare(strict_types=1);
3
4
namespace Ely\Mojang\Response;
5
6
class RefreshResponse {
7
8
    /**
9
     * @var string
10
     */
11
    private $accessToken;
12
13
    /**
14
     * @var string
15
     */
16
    private $clientToken;
17
18
    /**
19
     * @var array
20
     */
21
    private $rawSelectedProfile;
22
23
    /**
24
     * @var array
25
     */
26
    private $rawUser;
27
28 1
    public function __construct(
29
        string $accessToken,
30
        string $clientToken,
31
        array $selectedProfile,
32
        array $user
33
    ) {
34 1
        $this->accessToken = $accessToken;
35 1
        $this->clientToken = $clientToken;
36 1
        $this->rawSelectedProfile = $selectedProfile;
37 1
        $this->rawUser = $user;
38 1
    }
39
40 1
    public function getAccessToken(): string {
41 1
        return $this->accessToken;
42
    }
43
44 1
    public function getClientToken(): string {
45 1
        return $this->clientToken;
46
    }
47
48 1
    public function getSelectedProfile(): ProfileInfo {
49 1
        return ProfileInfo::createFromResponse($this->rawSelectedProfile);
50
    }
51
52 1
    public function getUser(): AuthenticationResponseUserField {
53 1
        return new AuthenticationResponseUserField($this->rawUser['id'], $this->rawUser['properties']);
54
    }
55
56
}
57