1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Syntax\SteamApi\Containers; |
4
|
|
|
|
5
|
|
|
use NukaCode\Database\Collection; |
6
|
|
|
|
7
|
|
|
class App extends BaseContainer |
8
|
|
|
{ |
9
|
|
|
public $id; |
10
|
|
|
|
11
|
|
|
public $type; |
12
|
|
|
|
13
|
|
|
public $name; |
14
|
|
|
|
15
|
|
|
public $controllerSupport; |
16
|
|
|
|
17
|
|
|
public $description; |
18
|
|
|
|
19
|
|
|
public $about; |
20
|
|
|
|
21
|
|
|
public $fullgame; |
22
|
|
|
|
23
|
|
|
public $header; |
24
|
|
|
|
25
|
|
|
public $website; |
26
|
|
|
|
27
|
|
|
public $pcRequirements; |
28
|
|
|
|
29
|
|
|
public $legal; |
30
|
|
|
|
31
|
|
|
public $developers; |
32
|
|
|
|
33
|
|
|
public $publishers; |
34
|
|
|
|
35
|
|
|
public $price; |
36
|
|
|
|
37
|
|
|
public $platforms; |
38
|
|
|
|
39
|
|
|
public $metacritic; |
40
|
|
|
|
41
|
|
|
public $categories; |
42
|
|
|
|
43
|
2 |
|
public $genres; |
44
|
|
|
|
45
|
2 |
|
public $release; |
46
|
2 |
|
|
47
|
2 |
|
public $requiredAge; |
48
|
2 |
|
|
49
|
2 |
|
public $isFree; |
50
|
2 |
|
|
51
|
2 |
|
public $shortDescription; |
52
|
2 |
|
|
53
|
2 |
|
public $supportedLanguages; |
54
|
2 |
|
|
55
|
2 |
|
public $recommendations; |
56
|
2 |
|
|
57
|
2 |
|
public $achievements; |
58
|
2 |
|
|
59
|
2 |
|
public $dlc; |
60
|
2 |
|
|
61
|
2 |
|
public function __construct($app) |
62
|
2 |
|
{ |
63
|
|
|
|
64
|
2 |
|
$this->id = $app->steam_appid; |
65
|
|
|
$this->type = $app->type; |
66
|
2 |
|
$this->name = $app->name; |
67
|
2 |
|
$this->controllerSupport = $this->checkIssetField($app, 'controller_support', 'None'); |
68
|
2 |
|
$this->description = $app->detailed_description; |
69
|
|
|
$this->about = $app->about_the_game; |
70
|
2 |
|
$this->fullgame = $this->checkIssetField($app, 'fullgame', $this->getFakeFullgameObject()); |
71
|
|
|
$this->header = $app->header_image; |
72
|
|
|
$this->website = $this->checkIsNullField($app, 'website', 'None'); |
73
|
2 |
|
$this->pcRequirements = $app->pc_requirements; |
74
|
|
|
$this->legal = $this->checkIssetField($app, 'legal_notice', 'None'); |
75
|
2 |
|
$this->developers = $this->checkIssetCollection($app, 'developers'); |
76
|
2 |
|
$this->publishers = new Collection($app->publishers); |
77
|
|
|
$this->price = $this->checkIssetField($app, 'price_overview', $this->getFakePriceObject()); |
78
|
2 |
|
$this->platforms = $app->platforms; |
79
|
|
|
$this->metacritic = $this->checkIssetField($app, 'metacritic', $this->getFakeMetacriticObject()); |
80
|
|
|
$this->categories = $this->checkIssetCollection($app, 'categories'); |
81
|
1 |
|
$this->genres = $this->checkIssetCollection($app, 'genres'); |
82
|
|
|
$this->release = $app->release_date; |
83
|
|
|
$this->requiredAge = (int)$app->required_age; |
84
|
|
|
$this->isFree = $app->is_free; |
85
|
|
|
$this->shortDescription = $app->short_description; |
86
|
|
|
$this->supportedLanguages = $app->supported_languages; |
87
|
|
|
$this->recommendations = $this->checkIssetField($app, 'recommendations', $this->getFakeRecommendationsObject()); |
88
|
|
|
$this->achievements = $this->checkIssetField($app, 'achievements', $this->getFakeAchievementsObject()); |
89
|
|
|
$this->dlc = $this->checkIssetCollection($app, 'dlc', new Collection()); |
90
|
|
|
|
91
|
|
|
} |
92
|
|
|
|
93
|
|
|
protected function getFakeMetacriticObject() |
94
|
|
|
{ |
95
|
|
|
$object = new \stdClass(); |
96
|
|
|
$object->url = null; |
97
|
|
|
$object->score = 'No Score'; |
98
|
|
|
return $object; |
99
|
|
|
} |
100
|
|
|
|
101
|
|
|
protected function getFakePriceObject() |
102
|
|
|
{ |
103
|
|
|
$object = new \stdClass(); |
104
|
|
|
$object->final = 'No price found'; |
105
|
|
|
return $object; |
106
|
|
|
} |
107
|
|
|
|
108
|
|
|
protected function getFakeFullgameObject() |
109
|
|
|
{ |
110
|
|
|
$object = new \stdClass(); |
111
|
|
|
$object->appid = null; |
112
|
|
|
$object->name = 'No parent game found'; |
113
|
|
|
return $object; |
114
|
|
|
} |
115
|
|
|
|
116
|
|
|
protected function getFakeRecommendationsObject() |
117
|
|
|
{ |
118
|
|
|
$object = new \stdClass(); |
119
|
|
|
$object->total = 0; |
120
|
|
|
return $object; |
121
|
|
|
} |
122
|
|
|
|
123
|
|
|
protected function getFakeAchievementsObject() |
124
|
|
|
{ |
125
|
|
|
$object = new \stdClass(); |
126
|
|
|
$object->total = 0; |
127
|
|
|
return $object; |
128
|
|
|
} |
129
|
|
|
} |
130
|
|
|
|