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