private function getVehicleTypeOverride() { $agencyShortTitle = $this->agency->getShortTitle(); $config = $this->appConfig; $filePath = $config['sfmuni_vehicle_override']; //TODO: Check for exception $xmlObjBuilder = new XmlObjBuilder($filePath); $xml = $xmlObjBuilder->getXmlObj(); $vehicleOverrides = array(); //We only support SF-Muni for now if ($agencyShortTitle == "sf-muni") { foreach ($xml->route as $r) { $routeTag = (string) $r['tag']; $vehicleType = (string) $r['vehicle']; $vehicleOverrides[$routeTag] = $vehicleType; } } return $vehicleOverrides; }
private function getDirectionOverrides() { $config = $this->appConfig; $filePath = $config['location_override']; //TODO: Check for exception $xmlObjBuilder = new XmlObjBuilder($filePath); $xml = $xmlObjBuilder->getXmlObj(); $routeArray = array(); foreach ($xml->agency as $a) { $shortTitle = $a['shortTitle']; //We only want the overrides for the current agency if ($this->agency->getShortTitle() == $shortTitle) { foreach ($a->route as $r) { $routeTag = (string) $r['tag']; foreach ($r->direction as $d) { $routeArray[$routeTag][] = (string) $d['tag']; } } } } return $routeArray; }
/** * Read flip stop overrides from a file and return them as an array. * NOTE: This method returns the flip stops only for the agency being processed * * @return Array - stopTag => flipStopTag */ private function getFlipStopOverrides() { $agencyShortTitle = $this->agency->getShortTitle(); $config = $this->appConfig; $filePath = $config['flip_stop_override']; //TODO: Check for exception $xmlObjBuilder = new XmlObjBuilder($filePath); $xml = $xmlObjBuilder->getXmlObj(); $flipStopMap = array(); foreach ($xml->agency as $tempAgency) { if ((string) $tempAgency["shortTitle"] != $agencyShortTitle) { continue; } foreach ($tempAgency->stop as $tempStop) { $stopTag = (string) $tempStop["tag"]; $flipStopTag = (string) $tempStop["reverseStopTag"]; $flipStopMap[$stopTag] = $flipStopTag; if (!empty($flipStopTag)) { $flipStopMap[$flipStopTag] = $stopTag; } } } return $flipStopMap; }