Skip to content

Commit

Permalink
Add default empty stationboard response
Browse files Browse the repository at this point in the history
  • Loading branch information
fabian committed Oct 10, 2024
1 parent b3d9220 commit d184ffa
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/Transport/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,6 @@ public function __construct()
* )
*/
$app->get('/v1/stationboard', function (Request $request) use ($app) {
$stationboard = [];

$limit = $request->get('limit', 40);
if ($limit > 420) {
Expand Down Expand Up @@ -511,6 +510,13 @@ public function __construct()

$query->maxJourneys = $limit;
$stationboard = $app['api']->getStationBoard($query);
} else {

// default empty response
$stationboard = [
'station' => null,
'stationboard' => [],
];
}

$json = $app['serializer']->serialize((object) $stationboard, 'json');
Expand Down

0 comments on commit d184ffa

Please sign in to comment.