diff options
-rw-r--r-- | index.php | 19 |
1 files changed, 8 insertions, 11 deletions
@@ -27,29 +27,26 @@ function getData($type, $route, $direction, $day) { $timetables = json_decode(file_get_contents("timetable_full.json"), true); switch ($type){ case "routes": - $result = $timetables['timetables']; + return $timetables['timetables']; break; case "trips": - $result = $timetables['timetables'][$route]['timetable'][$direction][$day]['trips']; + return $timetables['timetables'][$route]['timetable'][$direction][$day]['trips']; break; case "stoplist": - $result = $timetables['timetables'][$route]['timetable'][$direction]['stops_list']; + return $timetables['timetables'][$route]['timetable'][$direction]['stops_list']; break; case "schedule": - $result = $timetables['timetables'][$route]; + return $timetables['timetables'][$route]; break; case "meta": - $result = $timetables['meta']; + return $timetables['meta']; break; case "service": - $result = json_decode(file_get_contents("service_updates.json"), true); + return json_decode(file_get_contents("service_updates.json"), true); default: + return False; break; - } - if (!$result) { - $result = False; - } - return $result; + } } $servUpdates = getData('service', false, false, false); |