<?php
namespace App\Amadeus\FileParser; class Line_OPL extends \App\Amadeus\FileParser\LineAbstract { protected $structure = [ ['name'=> 'MSGTAG', 'val' => 'OPL', 'type' => 'AN', 'req' => 'M', 'len' => 3,], ['name'=> 'OPRMK', 'type' => 'AN', 'req' => 'M',], ['name'=> 'PSGASS', 'val' => ';P', 'type' => 'ASSOC',], ]; public function parse() { $matches = []; preg_match("/^(?P<MSGTAG>OPL)(?P<OPRMK>.*?)(?P<PSGASS>\;P[0-9-,]+)?$/", $this->content, $matches); $this->tree['MSGTAG'] = $matches['MSGTAG']; $this->tree['OPRMK'] = $matches['OPRMK']; $this->tree['PSGASS'] = $matches['PSGASS']; $struct = $this->structure[2]; if($matches['PSGASS'] && ($v = $this->parseFromStructure_v2_generalAssoc($struct, $this->tree['PSGASS'], 0, []))){ $this->tree[$struct['name']] = $v['value']; } $this->postParse(); return $this; } } 