<?php
namespace App\Galileo\StructureParser\Structures\LCCTicketing; class Documents extends \App\Galileo\StructureParser\Structures\NDCTicketing\Documents { use LCCTrait; protected function _getData() { list($parsedStructure, $transactionType, $transactionIndexes, ) = $this->getTransactionDetails(); $item = new \App\Galileo\StructureParser\Types\Document(); $item->docDate = $parsedStructure['header']['line2']['T50PNR']; $item->docNumber = sprintf("%s_%s", $parsedStructure['A14_LCC']['REF']['RECLOC'], $transactionIndexes['passengerIdentifier']); $item = $this->populateForNDC($item, $parsedStructure, $transactionType, $transactionIndexes); $item->transactionCode = $this->populateTransactionCodeForLCC($parsedStructure, $transactionType, $transactionIndexes); $item->RECLOC = $parsedStructure['header']['line2']['T50RCL']; return $item; } public function populateTransactionCodeForLCC($parsedStructure, $transactionType, $transactionIndexes) { $RECLOC = $parsedStructure['A14_LCC']['REF']['RECLOC']; $A14FlightDetailsForSegment = $this->getA14FlightDetailsForSegment($parsedStructure, $transactionIndexes); $paxIdxStr = $transactionIndexes['passengerIdentifier']; $segIdxsStr = substr(md5(implode(",", array_map(function ($seg) { return $seg['FlightDetailsForSegment']['carrierCode'] . $seg['FlightDetailsForSegment']['flightNumber']; }, $A14FlightDetailsForSegment) )), 0, 4); return sprintf("%s-%s-%s", $RECLOC, $paxIdxStr, $segIdxsStr); } } 