fitness-web/common/components/giro/GiroDETSTA.php

50 lines
1007 B
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;
}
}