<?php
namespace App\Galileo\NDCFileParser; class NDC extends \App\Utils\BaseParser\TextParser\FileParser\ParserForIndividualLines { protected $extractRegexp = "/^(?P<rawData>.+)/"; protected $children = [ [ 'key'=>'REF', 'type'=>'Data_REF', ], [ 'key'=>'OID', 'type'=>'Data_OID', ], [ 'key'=>'PassengerFares', 'startsWith'=>'Data_PassengerFare', 'rep'=> [0, 10], 'children'=>[ [ 'key'=>'PassengerFare', 'type'=>'Data_PassengerFare', ], [ 'key'=>'PassengerTaxBreakdown', 'startsWith'=>'Data_PassengerTaxBreakdown', 'rep'=> [0, 4], 'children'=>[ [ 'key'=>'PassengerTaxBreakdown', 'type'=>'Data_PassengerTaxBreakdown', ], ]], ]], [ 'key'=>'PassengerFareTypes', 'startsWith'=>'Data_PassengerFareType', 'rep'=> [0, 10], 'children'=>[ [ 'key'=>'PassengerFareType', 'type'=>'Data_PassengerFareType', ], ]], [ 'key'=>'FlightDetails', 'startsWith'=>'Data_FlightDetailsForSegment', 'rep'=> [0, 10], 'children'=>[ ['key'=>'FlightDetailsForSegment', 'type'=>'Data_FlightDetailsForSegment', ], ]], [ 'key'=>'TransactionTotal', 'type'=>'Data_TransactionTotal', ], [ 'key'=>'FareBasis', 'startsWith'=>'Data_FareBasis', 'rep'=> [0, 10], 'children'=>[ [ 'key'=>'FareBasis', 'type'=>'Data_FareBasis', ], ]], [ 'key'=>'ReservationConfirmed', 'type'=>'Data_ReservationConfirmed', ], [ 'key'=>'TicketTimeLimit', 'type'=>'Data_TicketTimeLimit', ], [ 'key'=>'OBFees', 'startsWith'=>'Data_OBFee', 'rep'=> [0, 10], 'children'=>[ [ 'key'=>'OBFee', 'type'=>'Data_OBFee', ], ]], [ 'key'=>'AggregatorFee', 'startsWith'=>'Data_AggregatorFee', 'rep'=> [0, 10], 'children'=>[ ['key'=>'AggregatorFee', 'type'=>'Data_AggregatorFee', ], ]], [ 'key'=>'TicketNumbers', 'startsWith'=>'Data_TicketNumbers', 'rep'=> [0, 10], 'children'=>[ [ 'key'=>'TicketNumbers', 'type'=>'Data_TicketNumbers', ], ]], [ 'key'=>'FormOfPayment', 'type'=>'Data_FormOfPayment', ], [ 'key'=>'OBFees', 'startsWith'=>'Data_OBFee', 'rep'=> [0, 10], 'children'=>[ [ 'key'=>'OBFee', 'type'=>'Data_OBFee', ], ]], [ 'key'=>'ExtraTransactions', 'startsWith'=>'Data_RemarksTransactionReason', 'rep'=> [0, 10], 'children'=>[ [ 'key'=>'RemarksTransactionReason', 'type'=>'Data_RemarksTransactionReason', ], [ 'key'=>'Reissue', 'startsWith'=>'Data_PassengerFare', 'rep'=> [0, 3], 'children'=>[ [ 'key'=>'PassengerFares', 'startsWith'=>'Data_PassengerFare', 'rep'=> [0, 10], 'children'=>[ [ 'key'=>'PassengerFare', 'type'=>'Data_PassengerFare', ], [ 'key'=>'PassengerTaxBreakdown', 'startsWith'=>'Data_PassengerTaxBreakdown', 'rep'=> [0, 4], 'children'=>[ [ 'key'=>'PassengerTaxBreakdown', 'type'=>'Data_PassengerTaxBreakdown', ], ]], ]], [ 'key'=>'OBFees', 'startsWith'=>'Data_OBFee', 'rep'=> [0, 10], 'children'=>[ [ 'key'=>'OBFee', 'type'=>'Data_OBFee', ], ]], [ 'key'=>'PassengerFareTypes', 'startsWith'=>'Data_PassengerFareType', 'rep'=> [0, 10], 'children'=>[ [ 'key'=>'PassengerFareType', 'type'=>'Data_PassengerFareType', ], ]], [ 'key'=>'FlightDetails', 'startsWith'=>'Data_FlightDetailsForSegment', 'rep'=> [0, 10], 'children'=>[ ['key'=>'FlightDetailsForSegment', 'type'=>'Data_FlightDetailsForSegment', ], ]], [ 'key'=>'TransactionTotal', 'type'=>'Data_TransactionTotal', ], [ 'key'=>'FareBasis', 'startsWith'=>'Data_FareBasis', 'rep'=> [0, 10], 'children'=>[ [ 'key'=>'FareBasis', 'type'=>'Data_FareBasis', ], ]], [ 'key'=>'ReservationConfirmed', 'type'=>'Data_ReservationConfirmed', ], ]], [ 'key'=>'Ancillaries', 'type'=>'Data_Ancillaries', ], [ 'key'=>'OtherAncillaries', 'type'=>'Data_OtherAncillaries', ], ]], [ 'key'=>'FormOfPayment', 'type'=>'Data_FormOfPayment', ], ]; public function createObject($type, $options, $self) { $options['req'] = true; $obj = null; $class = sprintf("\App\Galileo\NDCLineParser\Types\%s", $type); if (class_exists($class)) { $obj = new $class($options, $self); } $class = sprintf("\App\Galileo\LineParser\Types\%s", $type); if (class_exists($class)) { $obj = new $class($options, $self); } if (!$obj) { $obj = parent::createObject($type, $options, $self); } $obj->setHelper($this->lineHelper); return $obj; } protected function postExtract(\App\Utils\BaseParser\TextParser\ExtractedBlock $ret) { return parent::postExtract($ret); } public function getFileId() { return null; } } 