29 lines
503 B
PHP
29 lines
503 B
PHP
<?php
|
|
|
|
namespace 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;
|
|
}
|
|
}
|
|
|
|
?>
|