<?php
namespace App\Galileo\StructureParser\Structures\NDCReissue; class Itinerary extends \App\Galileo\StructureParser\Structures\Base\Itinerary { protected function _getData() { list($parsedStructure, , $transactionIndexes, ) = $this->getTransactionDetails(); $item = new \App\Galileo\StructureParser\Types\Itinerary(); if ($parsedStructure['A14_NDC']['FlightDetails']) { foreach ($parsedStructure['A14_NDC']['FlightDetails'] as $seg) { $segment = new \App\Galileo\StructureParser\Types\ItinerarySegment(); $dep = new \App\Galileo\StructureParser\Types\ItineraryLocation(); $match = $this->match([ 'airportCode' => [ $seg['FlightDetailsForSegment']['origin'], ], ]); $dep->suggest("airportCode", $seg['FlightDetailsForSegment']['origin']); $dep->airportCode = $seg['FlightDetailsForSegment']['origin']; $dep->cityId = $match->cityId; $dep->countryCode = $match->countryCode; $dep->date = $seg['FlightDetailsForSegment']['date']; $dep->time = $seg['FlightDetailsForSegment']['departureTime']; $segment->departure = $dep; $dest = new \App\Galileo\StructureParser\Types\ItineraryLocation(); $match = $this->match([ 'airportCode' => [ $seg['FlightDetailsForSegment']['destination'], ], ]); $dest->suggest("airportCode", $seg['FlightDetailsForSegment']['destination']); $dest->airportCode = $match->airportCode; $dest->cityId = $match->cityId; $dest->countryCode = $match->countryCode; $dest->date = $seg['FlightDetailsForSegment']['date']; $dest->time = $seg['FlightDetailsForSegment']['arrivalTime']; $segment->destination = $dest; $segment->supplier->codeAirline = $seg['FlightDetailsForSegment']['carrierCode']; $segment->transportNumber = $seg['FlightDetailsForSegment']['flightNumber']; $segment->serviceClassCode = $seg['FlightDetailsForSegment']['classCode']; $item->appendSegment($segment); } } return $item; } } 