<?php
namespace App\Amadeus\FileParser; class Line_FE extends \App\Amadeus\FileParser\LineAbstract { protected $structure = [ ['name'=> 'MSGTAG', 'val' => 'FE', 'type' => 'AN', 'req' => 'M', 'len' => 2,], ['name'=> 'ENDORSE', 'type' => 'customCall', 'call'=> 'ENDORSE',], ['name'=> 'SEGASS', 'val' => 'S', 'type' => 'ASSOC:loose',], ['name'=> 'PSGASS', 'val' => 'P', 'type' => 'ASSOC:loose',], ]; function parseFromStructure_v2_custom_ENDORSE($tree, $struct, $content, $index, $options){ $matches = []; preg_match("/^(?P<ENDORSE>.+?)(;S[0-9,\-]+)?(;P[0-9,\-]+)?$/", substr($content, $index), $matches); if ($matches) { $tree['ENDORSE'] = $matches['ENDORSE']; $ret = []; $ret['index'] = $index + strlen($matches['ENDORSE']); $ret['tree'] = $tree; $ret['skipStructIndex'] = true; return $ret; } return null; } } 