Skip to content

Commit 14327d2

Browse files
committed
Add properties to App
1 parent d9ce47e commit 14327d2

2 files changed

Lines changed: 52 additions & 25 deletions

File tree

src/Syntax/SteamApi/Containers/App.php

Lines changed: 44 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -44,50 +44,71 @@ class App extends BaseContainer
4444

4545
public $release;
4646

47+
public $requiredAge;
48+
49+
public $isFree;
50+
51+
public $shortDescription;
52+
53+
public $supportedLanguages;
54+
55+
public $recommendations;
56+
57+
public $achievements;
58+
59+
public $dlc;
60+
4761
public function __construct($app)
4862
{
49-
$this->id = $app->steam_appid;
50-
$this->type = $app->type;
51-
$this->name = $app->name;
52-
$this->controllerSupport = $this->checkIssetField($app, 'controller_support', 'None');
53-
$this->description = $app->detailed_description;
54-
$this->about = $app->about_the_game;
55-
$this->fullgame = $this->checkIssetField($app, 'fullgame', $this->getFakeFullgameObject());
56-
$this->header = $app->header_image;
57-
$this->website = $this->checkIsNullField($app, 'website', 'None');
58-
$this->pcRequirements = $app->pc_requirements;
59-
$this->legal = $this->checkIssetField($app, 'legal_notice', 'None');
60-
$this->developers = $this->checkIssetCollection($app, 'developers');
61-
$this->publishers = new Collection($app->publishers);
62-
$this->price = $this->checkIssetField($app, 'price_overview', $this->getFakePriceObject());
63-
$this->platforms = $app->platforms;
64-
$this->metacritic = $this->checkIssetField($app, 'metacritic', $this->getFakeMetacriticObject());
65-
$this->categories = $this->checkIssetCollection($app, 'categories');
66-
$this->genres = $this->checkIssetCollection($app, 'genres');
67-
$this->release = $app->release_date;
63+
64+
$this->id = $app->steam_appid;
65+
$this->type = $app->type;
66+
$this->name = $app->name;
67+
$this->controllerSupport = $this->checkIssetField($app, 'controller_support', 'None');
68+
$this->description = $app->detailed_description;
69+
$this->about = $app->about_the_game;
70+
$this->fullgame = $this->checkIssetField($app, 'fullgame', $this->getFakeFullgameObject());
71+
$this->header = $app->header_image;
72+
$this->website = $this->checkIsNullField($app, 'website', 'None');
73+
$this->pcRequirements = $app->pc_requirements;
74+
$this->legal = $this->checkIssetField($app, 'legal_notice', 'None');
75+
$this->developers = $this->checkIssetCollection($app, 'developers');
76+
$this->publishers = new Collection($app->publishers);
77+
$this->price = $this->checkIssetField($app, 'price_overview', $this->getFakePriceObject());
78+
$this->platforms = $app->platforms;
79+
$this->metacritic = $this->checkIssetField($app, 'metacritic', $this->getFakeMetacriticObject());
80+
$this->categories = $this->checkIssetCollection($app, 'categories');
81+
$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 = $app->recommendations;
88+
$this->achievements = $app->achievements;
89+
$this->dlc = $this->checkIssetCollection($app, 'dlc');
90+
6891
}
6992

7093
protected function getFakeMetacriticObject()
7194
{
7295
$object = new \stdClass();
7396
$object->url = null;
7497
$object->score = 'No Score';
75-
7698
return $object;
7799
}
78100

79101
protected function getFakePriceObject()
80102
{
81103
$object = new \stdClass();
82104
$object->final = 'No price found';
83-
84105
return $object;
85106
}
86107

87108
protected function getFakeFullgameObject()
88109
{
89-
$object = new \stdClass();
110+
$object = new \stdClass();
90111
$object->appid = null;
91-
$object->name = 'No parent game found';
112+
$object->name = 'No parent game found';
92113
}
93114
}

tests/BaseTester.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ protected function checkGroupProperties($group)
108108
private function checkMainAppProperties($app)
109109
{
110110
$attributes = [
111-
'id', 'type', 'name', 'controllerSupport', 'description', 'about', 'fullgame', 'header', 'website'
111+
'id', 'type', 'name', 'controllerSupport', 'description', 'about', 'fullgame', 'header', 'website', 'shortDescription'
112112
];
113113
$this->assertObjectHasAttributes($attributes, $app);
114114
}
@@ -119,7 +119,7 @@ private function checkMainAppProperties($app)
119119
private function checkGeneralAppProperties($app)
120120
{
121121
$attributes = [
122-
'pcRequirements', 'legal', 'developers', 'publishers', 'price', 'platforms', 'metacritic', 'categories', 'genres', 'release'
122+
'pcRequirements', 'legal', 'developers', 'publishers', 'price', 'platforms', 'metacritic', 'categories', 'genres', 'release', 'requiredAge', 'isFree', 'supportedLanguages', 'recommendations'
123123
];
124124
$this->assertObjectHasAttributes($attributes, $app);
125125
}
@@ -139,6 +139,12 @@ private function checkNestedAppProperties($app)
139139

140140
$attributes = ['score', 'url'];
141141
$this->assertObjectHasAttributes($attributes, $app->metacritic);
142+
143+
$attributes = ['total'];
144+
$this->assertObjectHasAttributes($attributes, $app->recommendations);
145+
146+
$attributes = ['total'];
147+
$this->assertObjectHasAttributes($attributes, $app->achievements);
142148
}
143149

144150
/**

0 commit comments

Comments
 (0)