mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2025-07-31 01:34:12 +02:00
This removes duplicate code, fixes some issues introduced with UUIDs and does some cleanup fixes #2415 fixes #2442
36 lines
888 B
PHP
36 lines
888 B
PHP
<?php
|
|
|
|
namespace Icinga\Module\Director\Objects;
|
|
|
|
use Countable;
|
|
use Iterator;
|
|
use Icinga\Module\Director\IcingaConfig\IcingaConfigRenderer;
|
|
use Icinga\Module\Director\IcingaConfig\IcingaLegacyConfigHelper as c1;
|
|
|
|
class IcingaTimePeriodRanges extends IcingaRanges implements Iterator, Countable, IcingaConfigRenderer
|
|
{
|
|
protected $rangeClass = IcingaTimePeriodRange::class;
|
|
protected $objectIdColumn = 'timeperiod_id';
|
|
|
|
public function toLegacyConfigString()
|
|
{
|
|
if (empty($this->ranges) && $this->object->isTemplate()) {
|
|
return '';
|
|
}
|
|
|
|
$out = '';
|
|
|
|
foreach ($this->ranges as $range) {
|
|
$out .= c1::renderKeyValue(
|
|
$range->get('range_key'),
|
|
$range->get('range_value')
|
|
);
|
|
}
|
|
if ($out !== '') {
|
|
$out = "\n".$out;
|
|
}
|
|
|
|
return $out;
|
|
}
|
|
}
|