Skip to content

Commit

Permalink
Fix missing return and add default value to properties that are not n…
Browse files Browse the repository at this point in the history
…ot necessary set
  • Loading branch information
cbaconnier committed Aug 20, 2018
1 parent 14327d2 commit 2c0e704
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions src/Syntax/SteamApi/Containers/App.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,9 @@ public function __construct($app)
$this->isFree = $app->is_free;
$this->shortDescription = $app->short_description;
$this->supportedLanguages = $app->supported_languages;
$this->recommendations = $app->recommendations;
$this->achievements = $app->achievements;
$this->dlc = $this->checkIssetCollection($app, 'dlc');
$this->recommendations = $this->checkIssetField($app, 'recommendations', $this->getFakeRecommendationsObject());
$this->achievements = $this->checkIssetField($app, 'achievements', $this->getFakeAchievementsObject());
$this->dlc = $this->checkIssetCollection($app, 'dlc', new Collection());

}

Expand All @@ -110,5 +110,20 @@ protected function getFakeFullgameObject()
$object = new \stdClass();
$object->appid = null;
$object->name = 'No parent game found';
return $object;
}

protected function getFakeRecommendationsObject()
{
$object = new \stdClass();
$object->total = 0;
return $object;
}

protected function getFakeAchievementsObject()
{
$object = new \stdClass();
$object->total = 0;
return $object;
}
}

0 comments on commit 2c0e704

Please sign in to comment.