public static function init() { if (!self::$gtfs) { self::$gtfs = new GTFSReader(SHUTTLE_GTFS_FEED, 'r'); self::$gtfs->parse(); self::$agencies = array( 'mit' => new NextBusAgency('mit'), 'charles-river' => new NextBusAgency('charles-river'), 'saferide' => new NextBusAgency('mit', 'saferide'), ); $saferide = array( 'saferidebostone', 'saferidebostonw', 'saferidebostonall', 'saferidecambeast', 'saferidecambwest', 'saferidecamball', ); // the 'mit' agency should catch new routes from nextbus self::$agencies['mit']->blackList($saferide); self::$agencies['saferide']->whiteList($saferide); $time = time(); foreach (self::$agencies as $agency_id => $nbAgency) { $gtfsAgency = self::$gtfs->getAgency($agency_id); foreach ($gtfsAgency->routes as $route_id => $route) { if ($route->isInService($time)) { $nbAgency->addRoute($route); } } foreach ($nbAgency->getAllStops() as $stop_id => $stop) { self::$gtfs->setStop($stop_id, $stop); } } // start writing contents if we can sync up // nextbus direction id's with trip id's //self::$gtfs->write('routes.txt'); //self::$gtfs->write('trips.txt'); //self::$gtfs->write('stop_times.txt'); } }