Passed
Push — master ( 9aa048...898b5e )
by Mattia
04:05
created

MojangAccount::toArray()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 7
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Minepic\Minecraft;
6
7
use Illuminate\Contracts\Support\Arrayable;
8
9
/**
10
 * Class MojangAccount.
11
 */
12
class MojangAccount implements Arrayable
13
{
14
    /**
15
     * UUID of the account.
16
     *
17
     * @var string
18
     */
19
    private string $uuid;
20
21
    /**
22
     * Username of the account.
23
     *
24
     * @var string
25
     */
26
    private string $username;
27
28
    /**
29
     * Skin.
30
     *
31
     * @var string
32
     */
33
    private string $skin;
34
35
    /**
36
     * Cape.
37
     *
38
     * @var string
39
     */
40
    private string $cape;
41
42
    /**
43
     * MinecraftAccount constructor.
44
     *
45
     * @param string $uuid
46
     * @param string $username
47
     * @param string $skin
48
     * @param string $cape
49
     */
50
    public function __construct(string $uuid, string $username, string $skin = '', string $cape = '')
51
    {
52
        $this->uuid = $uuid;
53
        $this->username = $username;
54
        $this->skin = $skin;
55
        $this->cape = $cape;
56
    }
57
58
    /**
59
     * @return string
60
     */
61
    public function getUuid(): string
62
    {
63
        return $this->uuid;
64
    }
65
66
    /**
67
     * @return string
68
     */
69
    public function getUsername(): string
70
    {
71
        return $this->username;
72
    }
73
74
    /**
75
     * @return string
76
     */
77
    public function getSkin(): ?string
78
    {
79
        return $this->skin;
80
    }
81
82
    /**
83
     * @return string
84
     */
85
    public function getCape(): ?string
86
    {
87
        return $this->cape;
88
    }
89
90
    /**
91
     * @return array
92
     */
93
    public function toArray(): array
94
    {
95
        return [
96
            'uuid' => $this->uuid,
97
            'username' => $this->username,
98
            'skin' => $this->skin,
99
            'cape' => $this->cape,
100
        ];
101
    }
102
}
103