<?php
namespace App\Sabre\StructureParser\Structures\Train; class Itinerary extends \App\Sabre\StructureParser\Structures\Base\Itinerary { protected function _getData() { list($parsedStructure, , $transactionIndexes, ) = $this->getTransactionDetails(); $M3 = $parsedStructure['M3'][$transactionIndexes['km3']]; $item = new \App\Sabre\StructureParser\Types\Itinerary(); $segment = new \App\Sabre\StructureParser\Types\ItinerarySegment(); $dep = new \App\Sabre\StructureParser\Types\ItineraryLocation(); $match = $this->match([ 'cityName' => [$M3['M3Oths']['IU3VR4_']['pickupPoint'], ], 'airportCode' => [$M3['M3Oths']['IU3VR4_']['FR'], ], ]); $dep->suggest('cityCode', $M3['M3Oths']['IU3VR4_']['pickupPoint']); $dep->airportCode = $match->airportCode; $dep->cityId = $match->cityId; $dep->countryCode = $match->countryCode; $dep->date = $M3['M3Oths']['IU3DDT']; $dep->time = $M3['M3Oths']['IU3VR4_']['LV']['time']; $segment->departure = $dep; $dest = new \App\Sabre\StructureParser\Types\ItineraryLocation(); $match = $this->match([ 'cityName' => [$M3['M3Oths']['IU3VR4_']['dropoffPoint'], ], 'airportCode' => [$M3['M3Oths']['IU3VR4_']['AT'], ], ]); $dest->suggest('cityCode', $M3['M3Oths']['IU3VR4_']['dropoffPoint']); $dest->airportCode = $match->airportCode; $dest->cityId = $match->cityId; $dest->countryCode = $match->countryCode; $dest->date = $M3['M3Oths']['IU3DDT']; $dest->time = $M3['M3Oths']['IU3VR4_']['AR']['time']; $segment->destination = $dest; $segment->transportNumber = $M3['M3Oths']['IU3VR4_']['NA']; $segment->transportSeatNumber = $M3['M3Oths']['IU3VR4_']['SP']['SEAT_NBR']; $segment->supplier->name = ($M3['M3Oths']['IU3VR4_']['SUP']?:$M3['M3Oths']['IU3VR4_']['supplier']); $item->appendSegment($segment); return $item; } } 