hedera-web/rest/edi/lib/section.php

26 lines
494 B
PHP
Raw Normal View History

<?php
2016-08-31 11:53:46 +00:00
namespace Edi;
2018-05-23 10:14:20 +00:00
require_once(__DIR__.'/segment.php');
2018-05-23 10:14:20 +00:00
class Section {
var $name;
var $parent = NULL;
var $segments = [];
var $childs = [];
2018-05-23 10:14:20 +00:00
function getValue($name, $key, $type = NULL, $subname = NULL) {
foreach ($this->segments as $segment)
if ($segment->name == $name
2018-05-23 10:14:20 +00:00
&&(!$subname || $segment->values[1] == $subname))
return $segment->getValue($key, $type);
if ($this->parent)
2018-05-23 10:14:20 +00:00
return $this->parent->getValue($name, $key, $type, $subname);
return NULL;
}
}