|
1
|
|
|
<?php namespace Syntax\SteamApi\Steam; |
|
2
|
|
|
|
|
3
|
|
|
use Syntax\SteamApi\Client; |
|
4
|
|
|
use Syntax\SteamApi\Collection; |
|
5
|
|
|
use Syntax\SteamApi\Containers\App as AppContainer; |
|
6
|
|
|
|
|
7
|
|
|
class App extends Client { |
|
8
|
|
|
|
|
9
|
3 |
|
public function __construct() |
|
10
|
|
|
{ |
|
11
|
3 |
|
parent::__construct(); |
|
12
|
3 |
|
$this->url = 'http://store.steampowered.com/'; |
|
13
|
3 |
|
$this->interface = 'api'; |
|
14
|
3 |
|
} |
|
15
|
|
|
|
|
16
|
2 |
|
public function appDetails($appIds) |
|
17
|
|
|
{ |
|
18
|
|
|
// Set up the api details |
|
19
|
2 |
|
$this->method = 'appdetails'; |
|
20
|
2 |
|
$this->version = null; |
|
21
|
|
|
|
|
22
|
|
|
// Set up the arguments |
|
23
|
|
|
$arguments = [ |
|
24
|
|
|
'appids' => $appIds |
|
25
|
2 |
|
]; |
|
26
|
|
|
|
|
27
|
|
|
// Get the client |
|
28
|
2 |
|
$client = $this->setUpClient($arguments); |
|
29
|
|
|
$apps = $this->convertToObjects($client); |
|
30
|
|
|
|
|
31
|
|
|
return $apps; |
|
32
|
|
|
} |
|
33
|
|
|
|
|
34
|
1 |
|
public function GetAppList() |
|
35
|
|
|
{ |
|
36
|
|
|
// Set up the api details |
|
37
|
1 |
|
$this->url = 'http://api.steampowered.com/'; |
|
38
|
1 |
|
$this->interface = 'ISteamApps'; |
|
39
|
1 |
|
$this->method = __FUNCTION__; |
|
40
|
1 |
|
$this->version = 'v0001'; |
|
41
|
|
|
|
|
42
|
|
|
// Get the client |
|
43
|
1 |
|
$client = $this->setUpClient(); |
|
44
|
|
|
|
|
45
|
|
|
return $client->applist->apps->app; |
|
46
|
|
|
} |
|
47
|
|
|
|
|
48
|
|
|
protected function convertToObjects($apps) |
|
49
|
|
|
{ |
|
50
|
|
|
$convertedApps = $this->convertGames($apps); |
|
51
|
|
|
|
|
52
|
|
|
$apps = $this->sortObjects($convertedApps); |
|
53
|
|
|
|
|
54
|
|
|
return $apps; |
|
55
|
|
|
} |
|
56
|
|
|
|
|
57
|
|
|
/** |
|
58
|
|
|
* @param $apps |
|
59
|
|
|
* |
|
60
|
|
|
* @return Collection |
|
61
|
|
|
*/ |
|
62
|
|
|
protected function convertGames($apps) |
|
63
|
|
|
{ |
|
64
|
|
|
$convertedApps = new Collection(); |
|
65
|
|
|
|
|
66
|
|
|
foreach ($apps as $app) { |
|
67
|
|
|
if (isset($app->data)) { |
|
68
|
|
|
$convertedApps->add(new AppContainer($app->data)); |
|
69
|
|
|
} |
|
70
|
|
|
} |
|
71
|
|
|
|
|
72
|
|
|
return $convertedApps; |
|
73
|
|
|
} |
|
74
|
|
|
} |