<?php
namespace App\Sabre\LineParser\Types\Line; class MB extends \App\Sabre\LineParser\Types\SabreBaseLine { protected $extractRegexp = "/^(?P<rawData>MB.*)/s"; protected $children = [ [ 'key'=>'IUBMID', 'type'=>'Constant', 'len'=>2, 'val'=>'MB', 'label'=>'IUBMID' ], [ 'key'=>'IUBPTY', 'type'=>'StringTrim', 'len'=>2, 'label'=>'IUBPTY' ], [ 'key'=>'IUBM1N', 'type'=>'StringTrim', 'len'=>2, 'label'=>'IUBM1N' ], [ 'key'=>'IUBINF', 'type'=>'StringMultilineEndingWithNewLine', 'label'=>'IUBINF' ], ]; protected function postExtract(\App\Utils\BaseParser\TextParser\ExtractedBlock $ret) { $ret->extractedData['IUBINF_'] = []; if ($ret->extractedData['IUBINF']) { foreach (explode("\n", $ret->extractedData['IUBINF']) as $IUBINF) { $values = $this->getExtractor()->find("/^(?P<tag>[A-Z0-9]+)\/(?P<value>.*)$/", $IUBINF)->cleanup()->getMatches(); $values['value'] = trim(implode("\n", array_map(function($s){ return trim($s); }, explode("@", $values['value'])))); if ($values['value']!=='') { $ret->extractedData['IUBINF_'][]= $values; } } } return $ret; } } 