1 | <?php |
||
10 | class Player extends Client |
||
11 | { |
||
12 | 9 | public function __construct($steamId) |
|
19 | |||
20 | 1 | public function GetSteamLevel() |
|
33 | |||
34 | 1 | public function GetPlayerLevelDetails() |
|
42 | |||
43 | 2 | public function GetBadges() |
|
56 | |||
57 | 1 | public function GetCommunityBadgeProgress($badgeId = null) |
|
58 | { |
||
59 | // Set up the api details |
||
60 | 1 | $this->setApiDetails(__FUNCTION__, 'v0001'); |
|
61 | |||
62 | // Set up the arguments |
||
63 | 1 | $arguments = ['steamId' => $this->steamId]; |
|
64 | 1 | if ($badgeId != null) { |
|
65 | $arguments['badgeid'] = $badgeId; |
||
66 | } |
||
67 | |||
68 | // Get the client |
||
69 | 1 | $client = $this->getServiceResponse($arguments); |
|
70 | |||
71 | 1 | return $client; |
|
72 | } |
||
73 | |||
74 | 2 | public function GetOwnedGames($includeAppInfo = true, $includePlayedFreeGames = false, $appIdsFilter = []) |
|
75 | { |
||
76 | // Set up the api details |
||
77 | 2 | $this->setApiDetails(__FUNCTION__, 'v0001'); |
|
78 | |||
79 | // Set up the arguments |
||
80 | 2 | $arguments = ['steamId' => $this->steamId]; |
|
81 | 2 | if ($includeAppInfo) { |
|
82 | 1 | $arguments['include_appinfo'] = $includeAppInfo; |
|
83 | } |
||
84 | 2 | if ($includePlayedFreeGames) { |
|
85 | $arguments['include_played_free_games'] = $includePlayedFreeGames; |
||
86 | } |
||
87 | 2 | if (count($appIdsFilter) > 0) { |
|
88 | $arguments['appids_filter'] = (array)$appIdsFilter; |
||
89 | } |
||
90 | |||
91 | // Get the client |
||
92 | 2 | $client = $this->getServiceResponse($arguments); |
|
93 | |||
94 | // Clean up the games |
||
95 | 2 | $games = $this->convertToObjects(isset($client->games) ? $client->games : []); |
|
96 | |||
97 | 2 | return $games; |
|
98 | } |
||
99 | |||
100 | 2 | public function GetRecentlyPlayedGames($count = null) |
|
101 | { |
||
102 | // Set up the api details |
||
103 | 2 | $this->setApiDetails(__FUNCTION__, 'v0001'); |
|
104 | |||
105 | // Set up the arguments |
||
106 | 2 | $arguments = ['steamId' => $this->steamId]; |
|
107 | 2 | if (! is_null($count)) { |
|
108 | 1 | $arguments['count'] = $count; |
|
109 | } |
||
110 | |||
111 | // Get the client |
||
112 | 2 | $client = $this->getServiceResponse($arguments); |
|
113 | |||
114 | 2 | if (isset($client->total_count) && $client->total_count > 0) { |
|
115 | // Clean up the games |
||
116 | 2 | $games = $this->convertToObjects($client->games); |
|
117 | |||
118 | 2 | return $games; |
|
119 | } |
||
120 | |||
121 | return null; |
||
122 | } |
||
123 | |||
124 | 1 | public function IsPlayingSharedGame($appIdPlaying) |
|
125 | { |
||
126 | // Set up the api details |
||
127 | 1 | $this->setApiDetails(__FUNCTION__, 'v0001'); |
|
128 | |||
129 | // Set up the arguments |
||
130 | $arguments = [ |
||
131 | 1 | 'steamId' => $this->steamId, |
|
132 | 1 | 'appid_playing' => $appIdPlaying, |
|
133 | ]; |
||
134 | |||
135 | // Get the client |
||
136 | 1 | $client = $this->getServiceResponse($arguments); |
|
137 | |||
138 | 1 | return $client->lender_steamid; |
|
139 | } |
||
140 | |||
141 | 4 | protected function convertToObjects($games) |
|
149 | |||
150 | 4 | private function convertGames($games) |
|
151 | { |
||
152 | 4 | $convertedGames = new Collection; |
|
153 | |||
160 | } |
||
161 |