| | |
| | | return $bestOffset; |
| | | } |
| | | |
| | | public function mapUsingOffset($offset) { |
| | | public function mapUsingOffset($offset, $mapper) { |
| | | $result = []; |
| | | foreach($this->gtfsrtTrips as $gtfsTripId => $gtfsTrip) { |
| | | $ttssTripId = $gtfsTripId + $offset; |
| | | if(isset($this->ttssTrips[$ttssTripId])) { |
| | | $data = numToTypeB($gtfsTrip['id']); |
| | | $data = $mapper($gtfsTrip['id']); |
| | | $num = $gtfsTrip['num']; |
| | | if(!is_array($data) || !isset($data['num'])) { |
| | | $data = [ |
| | | 'num' => $num, |
| | | 'low' => 2, |
| | | 'num' => $num ?: '??'.$gtfsTrip['id'], |
| | | 'low' => NULL, |
| | | ]; |
| | | } elseif($data['num'] != $num) { |
| | | // Ignore due to incorrect depot markings in the data |