Skip to content

Commit 2c0e704

Browse files
committed
Fix missing return and add default value to properties that are not not necessary set
1 parent 14327d2 commit 2c0e704

File tree

1 file changed

+18
-3
lines changed
  • src/Syntax/SteamApi/Containers

1 file changed

+18
-3
lines changed

src/Syntax/SteamApi/Containers/App.php

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,9 @@ public function __construct($app)
8484
$this->isFree = $app->is_free;
8585
$this->shortDescription = $app->short_description;
8686
$this->supportedLanguages = $app->supported_languages;
87-
$this->recommendations = $app->recommendations;
88-
$this->achievements = $app->achievements;
89-
$this->dlc = $this->checkIssetCollection($app, 'dlc');
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());
9090

9191
}
9292

@@ -110,5 +110,20 @@ protected function getFakeFullgameObject()
110110
$object = new \stdClass();
111111
$object->appid = null;
112112
$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;
113128
}
114129
}

0 commit comments

Comments
 (0)