<?php
namespace App\Sabre\LineParser\Types\Line; class M6 extends \App\Sabre\LineParser\Types\SabreBaseLine { protected $children = [ ['key'=>'IU6MID', 'type'=>'Constant', 'len'=>2, 'val'=>'M6', 'label'=>'IU6MID'], ['key'=>'IU6RTY', 'type'=>'StringTrim', 'len'=>3, 'label'=>'IU6RTY'], ['key'=>'IU6FCT', 'type'=>'StringTrim', 'len'=>1, 'req'=>false, 'label'=>'IU6FCT'], ['key'=>'IU6CPR', 'type'=>'StringTrim', 'len'=>1, 'req'=>false, 'label'=>'IU6CPR'], ['key'=>'IU6FC12', 'type'=>'StringRTrim', 'req'=>false, 'label'=>'IU6FC12'], ['key'=>'NL', 'type'=>'NewLine',], ]; protected function postExtract(\App\Utils\BaseParser\TextParser\ExtractedBlock $ret) { $ret->extractedData['IU6FC12_'] = [ 'unknownFormat' => true, ]; $ret->extractedData['IU6RTY_'] = (new \App\Utils\BaseParser\Utils\PassengerTypeParser())->loadTypesFromPreset('travelport')->match($ret->extractedData['IU6RTY']); if ($ret->extractedData['IU6RTY'] && $ret->extractedData['IU6FCT']==1 && !$ret->extractedData['IU6CPR']) { $fareCalculationExtractorObject = \App\Utils\BaseParser\Utils\FareCalculationExtractor::getInstance(); try { $ret->extractedData['IU6FC12_'] = $fareCalculationExtractorObject->extract($ret->extractedData['IU6FC12']); } catch (\App\Utils\BaseParser\TextParser\Exception\LineParser $ex) { $ret->extractedData['IU6FC12_'] = [ 'unknownFormat' => true, 'error' => true, 'message' => $ex->getMessage(), ]; } } return $ret; } } 