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

RefreshResponse::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 4
nc 1
nop 4
dl 0
loc 10
ccs 5
cts 5
cp 1
crap 1
rs 10
c 0
b 0
f 0
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