<?php
namespace App\Amadeus\FileParser; class Line_FH extends \App\Amadeus\FileParser\LineAbstract { protected $structure = [ ['name'=> 'MSGTAG', 'val' => 'FH', 'type' => 'AN', 'req' => 'M', 'len' => 2,], ['name'=> 'HANDTKT', 'type' => 'AN', 'req' => 'M', 'len_min' => 1, 'len_max' => 127,], ['name'=> 'SEGASS', 'val' => ';S', 'type' => 'ASSOC',], ['name'=> 'PSGASS', 'val' => ';P', 'type' => 'ASSOC',], ]; protected function postParse() { parent::postParse(); $matches = []; preg_match("/^(?P<airline>[0-9]{3})-(?P<tktNo>[0-9]+)(\/C[0-9-]+)?$/", $this->tree['HANDTKT'], $matches); $this->tree['HANDTKT_']['airline'] = $matches['airline']; $this->tree['HANDTKT_']['tktNo'] = $matches['tktNo']; } } 