<?php
namespace App\Amadeus\FileParser; class Line_KS extends \App\Amadeus\FileParser\LineAbstract { protected $structure = [ ['name'=> 'MSGTAG', 'val' => 'KS-', 'type' => 'AN', 'req' => 'M', 'len' => 3,], ['name'=> 'ISSUE', 'type' => 'AN', 'req' => 'M', 'len' => 1,], ['name'=> 'CURRTYP', 'type' => 'AN', 'len' => 3,], ['name'=> 'BASE', 'type' => 'N', 'req' => 'M', 'len' => 11,], ['name'=> 'DELIM', 'val' => ';', 'type' => 'AN', 'req' => 'M', 'len' => 1,], ['name'=> 'CURCODE', 'type' => 'AN', 'len' => 3,], ['name'=> 'EQVAMT', 'type' => 'AN', 'len' => 11,], ['name'=> 'DELIM', 'val' => ';', 'type' => 'AN', 'req' => 'M', 'len' => 1,], ['name' => 'TAXFLD', 'type' =>'composite', 'rep_min' =>1, 'rep_max' =>10, 'childs' => [ ['name'=> 'OTAXI', 'type' => 'S:trim', 'len' => 1,], ['name'=> 'TCURR', 'type' => 'AN', 'len' => 3,], ['name'=> 'TAXA', 'type' => 'S:trim', 'len' => 7,], ['name'=> 'TAXC', 'type' => 'S:trim', 'requires' => ['TAXA'], 'len' => 3,], ['name'=> 'TAXN', 'type' => 'AN', 'requires' => ['TAXC'], 'len' => 2,], ['name'=> 'DELIM', 'val' => ';', 'type' => 'AN', 'req' => 'M', 'len' => 1,], ]], ['name'=> 'CURRCDE', 'type' => 'AN', 'len' => 3,], ['name'=> 'TOTAMT', 'type' => 'N', 'req' => 'M', 'len' => 11,], ['name'=> 'DELIM', 'val' => ';', 'type' => 'AN', 'req' => 'M', 'len' => 1,], ['name'=> 'SELLBUY1', 'type' => 'N', 'len' => 11,], ['name'=> 'DELIM', 'val' => ';', 'type' => 'AN', 'req' => 'M', 'len' => 1,], ['name'=> 'SELLBUY2', 'type' => 'N', 'len' => 11,], ['name'=> 'DELIM', 'val' => ';', 'type' => 'AN', 'req' => 'M', 'len' => 1,], ['name'=> 'TRANCURR', 'type' => 'AN', 'len' => 3,], ]; protected function postParse() { parent::postParse(); if($this->tree['TAXFLD']){ $this->tree['TAXFLD'] = self::rtrimArrDeep($this->tree['TAXFLD'], 2); $this->tree['TAXFLD'] = self::extractTaxNameFromCode($this->tree['TAXFLD']); $this->tree['TAXFLD'] = self::fillTAXA($this->tree['TAXFLD']); $this->computeStats_taxes(); } $this->tree['_OneTwoCurrencyCodes'] = true; $EQVAMT = trim($this->tree['EQVAMT']); if(is_numeric($EQVAMT)){ $this->tree['_OneTwoCurrencyCodes'] = false; $this->tree['EQVAMT'] = (float)$EQVAMT; } } } 