mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-25 14:54:24 +02:00
parent
9edaaa82e8
commit
d2936d0338
48
modules/doc/library/Doc/DocToc.php
Normal file
48
modules/doc/library/Doc/DocToc.php
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
<?php
|
||||||
|
// {{{ICINGA_LICENSE_HEADER}}}
|
||||||
|
// {{{ICINGA_LICENSE_HEADER}}}
|
||||||
|
|
||||||
|
namespace Icinga\Module\Doc;
|
||||||
|
|
||||||
|
use IteratorAggregate;
|
||||||
|
use Icinga\Data\Tree\NodeInterface;
|
||||||
|
use Icinga\Data\Tree\TreeIterator;
|
||||||
|
|
||||||
|
class DocToc implements NodeInterface, IteratorAggregate
|
||||||
|
{
|
||||||
|
protected $children = array();
|
||||||
|
|
||||||
|
protected $value;
|
||||||
|
|
||||||
|
public function __construct($value = null)
|
||||||
|
{
|
||||||
|
$this->value = $value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getValue()
|
||||||
|
{
|
||||||
|
return $this->value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function appendChild($value)
|
||||||
|
{
|
||||||
|
$child = new self($value);
|
||||||
|
$this->children[] = $child;
|
||||||
|
return $child;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function hasChildren()
|
||||||
|
{
|
||||||
|
return ! empty($this->children);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getChildren()
|
||||||
|
{
|
||||||
|
return $this->children;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getIterator()
|
||||||
|
{
|
||||||
|
return new TreeIterator($this);
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user