<?php
namespace App\Amadeus\FileParser; class Line_MFO extends \App\Amadeus\FileParser\LineAbstract { protected $structure = [ ['name'=> 'MSGTAG', 'val' => 'MFO', 'type' => 'AN', 'req' => 'M', 'len' => 3,], ['name'=> 'ORIGEXCH', 'type' => 'AN', 'req' => 'M', 'len_min' => 1, 'len_max' => 127,], ['name'=> 'DELIM', 'val' => ';', 'type' => 'AN', 'len' => 1,], ['name'=> 'LINEASS', 'val' => 'L', 'type' => 'ASSOC:loose',], ['name'=> 'PSGASS', 'val' => 'P', 'type' => 'ASSOC:loose',], ['name'=> 'TSMASS', 'val' => 'D', 'type' => 'ASSOC:loose',], ]; protected $structure_AMA = [ ['name'=> 'MSGTAG', 'val' => 'MFO', 'type' => 'AN', 'req' => 'M', 'len' => 3,], ['name'=> 'ORIGEXCH', 'type' => 'AN', 'req' => 'M', 'len_min' => 1, 'len_max' => 127,], ['name'=> 'DELIM', 'val' => ';', 'type' => 'AN', 'req' => 'M', 'len' => 1,], ['name'=> 'LINEASS', 'val' => 'L', 'type' => 'ASSOC:loose',], ['name'=> 'DELIM', 'val' => ';', 'type' => 'AN', 'req' => 'M', 'len' => 1,], ['name'=> 'PSGASS', 'val' => 'P', 'type' => 'ASSOC:loose',], ['name'=> 'DELIM', 'val' => ';', 'type' => 'AN', 'req' => 'M', 'len' => 1,], ['name'=> 'TSMASS', 'val' => 'D', 'type' => 'ASSOC:loose',], ]; public function parse() { $parsed = false; if (!$parsed) { try{ $this->tree = $this->parseFromStructure($this->structure, $this->content); $this->postParse(); $parsed = true; }catch(\App\Amadeus\FileParser\ParserException $ex){ $parsed = false; } } if (!$parsed) { try{ $this->tree = $this->parseFromStructure($this->structure_AMA, $this->content); $this->postParse(); $parsed = true; }catch(\App\Amadeus\FileParser\ParserException $ex){ $parsed = false; } } if (!$parsed) { throw new \App\Amadeus\FileParser\ParserException("Unknown line structure for the MFO line"); } return $this; } } 