forked from verdnatura/hedera-web
29 lines
506 B
PHP
29 lines
506 B
PHP
|
<?php
|
||
|
|
||
|
namespace Vn\Edi;
|
||
|
|
||
|
require_once (__DIR__.'/segment.php');
|
||
|
|
||
|
class Section
|
||
|
{
|
||
|
var $name;
|
||
|
var $parent = NULL;
|
||
|
var $segments = [];
|
||
|
var $childs = [];
|
||
|
|
||
|
function getValue ($name, $key, $type = NULL, $subname = NULL)
|
||
|
{
|
||
|
foreach ($this->segments as $segment)
|
||
|
if ($segment->name == $name
|
||
|
&& (!$subname || $segment->values[1] == $subname))
|
||
|
return $segment->getValue ($key, $type);
|
||
|
|
||
|
if ($this->parent)
|
||
|
return $this->parent->getValue ($name, $key, $type, $subname);
|
||
|
|
||
|
return NULL;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
?>
|