1 | <?php |
||
5 | class Player extends BaseContainer |
||
6 | { |
||
7 | public $steamId; |
||
8 | |||
9 | public $steamIds; |
||
10 | |||
11 | public $communityVisibilityState; |
||
12 | |||
13 | public $profileState; |
||
14 | |||
15 | public $personaName; |
||
16 | |||
17 | public $lastLogoff; |
||
18 | |||
19 | public $profileUrl; |
||
20 | |||
21 | public $avatar; |
||
22 | |||
23 | public $avatarMedium; |
||
24 | |||
25 | public $avatarFull; |
||
26 | |||
27 | public $avatarUrl; |
||
28 | |||
29 | public $avatarMediumUrl; |
||
30 | |||
31 | public $avatarFullUrl; |
||
32 | |||
33 | public $personaState; |
||
34 | |||
35 | public $personaStateId; |
||
36 | |||
37 | public $realName; |
||
38 | |||
39 | public $primaryClanId; |
||
40 | |||
41 | public $timecreated; |
||
42 | |||
43 | public $personaStateFlags; |
||
44 | |||
45 | public $locCountryCode; |
||
46 | |||
47 | public $locStateCode; |
||
48 | |||
49 | public $locCityId; |
||
50 | |||
51 | public $location; |
||
52 | |||
53 | public $commentPermission; |
||
54 | |||
55 | public $gameDetails = null; |
||
56 | |||
57 | 4 | public function __construct($player) |
|
58 | { |
||
59 | 4 | $this->steamId = $player->steamid; |
|
60 | 4 | $this->steamIds = (new Id((int)$this->steamId)); |
|
61 | 4 | $this->communityVisibilityState = $player->communityvisibilitystate; |
|
62 | 4 | $this->profileState = $this->checkIssetField($player, 'profilestate'); |
|
63 | 4 | $this->personaName = $player->personaname; |
|
64 | 4 | $this->lastLogoff = date('F jS, Y h:ia', $this->checkIssetField($player, 'lastlogoff')); |
|
65 | 4 | $this->profileUrl = $player->profileurl; |
|
66 | 4 | $this->avatar = $this->getImageForAvatar($player->avatar); |
|
67 | 4 | $this->avatarMedium = $this->getImageForAvatar($player->avatarmedium); |
|
68 | 4 | $this->avatarFull = $this->getImageForAvatar($player->avatarfull); |
|
69 | 4 | $this->avatarUrl = $player->avatar; |
|
70 | 4 | $this->avatarMediumUrl = $player->avatarmedium; |
|
71 | 4 | $this->avatarFullUrl = $player->avatarfull; |
|
72 | 4 | $this->personaState = $this->convertPersonaState($player->personastate); |
|
73 | 4 | $this->personaStateId = $player->personastate; |
|
74 | 4 | $this->realName = $this->checkIssetField($player, 'realname'); |
|
75 | 4 | $this->primaryClanId = $this->checkIssetField($player, 'primaryclanid'); |
|
76 | 4 | $this->timecreated = $this->checkIssetField($player, 'timecreated'); |
|
77 | 4 | $this->personaStateFlags = $this->checkIssetField($player, 'personastateflags'); |
|
78 | 4 | $this->locCountryCode = $this->checkIssetField($player, 'loccountrycode'); |
|
79 | 4 | $this->locStateCode = $this->checkIssetField($player, 'locstatecode'); |
|
80 | 4 | $this->locCityId = $this->checkIssetField($player, 'loccityid'); |
|
81 | 4 | $this->location = $this->getLocation(); |
|
82 | 4 | $this->commentPermission = $this->checkIssetField($player, 'commentpermission'); |
|
83 | |||
84 | $gameDetails = [ |
||
85 | 4 | 'gameServerIp' => $this->checkIssetField($player, 'gameserverip'), |
|
86 | 4 | 'gameServerSteamId' => $this->checkIssetField($player, 'gameserversteamid'), |
|
87 | 4 | 'gameExtraInfo' => $this->checkIssetField($player, 'gameextrainfo'), |
|
88 | 4 | 'gameId' => $this->checkIssetField($player, 'gameid'), |
|
89 | ]; |
||
90 | |||
91 | 4 | if (! empty(array_filter($gameDetails))) |
|
92 | { |
||
93 | $this->gameDetails = (new GameDetails($player)); |
||
94 | } |
||
95 | 4 | } |
|
96 | |||
97 | 4 | protected function getLocation() |
|
118 | |||
119 | 4 | protected function convertPersonaState($personaState) |
|
149 | } |
||
150 |