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