Player profile API works
[gamestick-pjgsapi.git] / src / Profile.php
1 <?php
2 /**
3  * Database row from the "gamesticks" table
4  */
5 class Profile
6 {
7     public int $id;
8     public string $hwId;
9     public string $sessionId;
10     public ?string $verificationCode;
11     public ?string $gamerTag;
12     public bool $founderFlag;
13     public ?string $founderName;
14     public int $minAge;
15     public ?string $avatar;
16
17     public string $created_at;
18
19     public function complete(): bool
20     {
21         return $this->gamerTag !== null;
22     }
23
24     public function getAvatarLargeUrl(): string
25     {
26         if (strpos($this->avatar, '://')) {
27             return $this->avatar;
28         }
29         return 'http://l2.gamestickservices.net/resources/avatars/'
30             . $this->avatar . '.large.jpg';
31     }
32
33     public function getAvatarSmallUrl(): string
34     {
35         if (strpos($this->avatar, '://')) {
36             return $this->avatar;
37         }
38         return 'http://l2.gamestickservices.net/resources/avatars/'
39             . $this->avatar . '.small.jpg';
40     }
41 }