Пример #1
0
function getServiceIdDatePair($route_short_name, $service_id, $date)
{
    global $checkRouteAdd;
    // 1 - 1 mapping
    $trip_id = $route_short_name . $service_id . '1';
    global $language;
    // processor
    list($route, $stop_times, $serviceId_date_pair) = RouteFetcher::fetchRouteAndStopTimes($route_short_name, $date, $trip_id, $service_id, $language);
    if ($serviceId_date_pair == null && $route != null && $stop_times != null) {
        // Add already for performance
        // routes.txt
        if (!isset($checkRouteAdd[$route_short_name])) {
            addRoute($route);
            $checkRouteAdd[$route_short_name] = true;
        }
        // trips.txt
        $trip = generateTrip($route_short_name, $service_id, $trip_id);
        addTrip($trip);
        // stop_times.txt
        addStopTimes($stop_times);
    }
    return $serviceId_date_pair;
}
Пример #2
0
<?php

/**
 * TODO: php unit
 * Right now, you can run this by the command line to test the fetch route function
 */
require '../vendor/autoload.php';
use iRail\brail2gtfs\RouteFetcher;
var_dump(RouteFetcher::fetchRoute("P8008", "15.05.2015"));