70 lines
1.8 KiB
PHP
70 lines
1.8 KiB
PHP
<?php
|
|
|
|
namespace common\components\giro;
|
|
|
|
use common\components\giro\GiroBase;
|
|
|
|
/**
|
|
*
|
|
* @property common\components\giro\GiroDETSTAFej $fej
|
|
* @property common\components\giro\GiroDETSTALab $lab
|
|
* @property common\components\giro\GiroDETSTATetel $tetelek
|
|
*
|
|
*/
|
|
class GiroDETSTA extends GiroBase {
|
|
|
|
public $fej;
|
|
public $lab;
|
|
public $tetelek = [];
|
|
|
|
public function __construct() {
|
|
}
|
|
|
|
|
|
public function toString(){
|
|
$s = "";
|
|
$s .= $this->fej->toString();
|
|
foreach ($this->tetelek as $tetel ){
|
|
$s .= $tetel->toString();
|
|
}
|
|
$s .= $this->lab->toString();
|
|
|
|
return $s;
|
|
}
|
|
|
|
|
|
public static function parse($content){
|
|
$detsta = new GiroDETSTA();
|
|
$array = preg_split("/\r\n|\n|\r/", $content);
|
|
$detsta->fej = GiroDETSTAFej::parse($array[0]);
|
|
$detsta->lab = GiroDETSTALab::parse($array[count($array) -2]);
|
|
|
|
for ( $i = 1 ; $i < count($array) -2; $i++ ){
|
|
$row = $array[$i];
|
|
$tetel = GiroDETSTATetel::parse($row);
|
|
$detsta->tetelek[] = $tetel;
|
|
}
|
|
return $detsta;
|
|
}
|
|
|
|
/**
|
|
* @param common\components\giro\GiroBeszed $beszed
|
|
* */
|
|
public static function createBeszedAnswer($beszed){
|
|
// /**@var common\components\giro\GiroBeszed $beszed*/
|
|
$beszed = new GiroBeszed();
|
|
$detsta = new GiroDETSTA();
|
|
$detsta->fej = new GiroDETSTAFej();
|
|
|
|
$detsta->fej->jelentesJelzo = 8;
|
|
$detsta->fej->kezdemenyezoAzonosito = $beszed->fej->kezdemenyezoAzonosito;
|
|
$detsta->fej->csoportosUzenetSorszam->osszeallitasDatuma = $beszed->fej->uzenetSorszam->osszeallitasDatuma;
|
|
$detsta->fej->csoportosUzenetSorszam->sorszam = $beszed->fej->uzenetSorszam->sorszam;
|
|
$detsta->fej->detstaUzenetSorszam->osszeallitasDatuma = $beszed->fej->uzenetSorszam->osszeallitasDatuma;
|
|
$detsta->fej->detstaUzenetSorszam = $beszed->fej->uzenetSorszam->sorszam;
|
|
|
|
|
|
$detsta->lab = new GiroDETSTALab();
|
|
}
|
|
|
|
} |