From f66ab8dae2f3d0418759f81a3a64dc9517a62449 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 14 Apr 2024 15:17:31 +0200 Subject: Adding upstream version 1.10.2. Signed-off-by: Daniel Baumann --- .../IcingaConfig/IcingaLegacyConfigHelper.php | 110 +++++++++++++++++++++ 1 file changed, 110 insertions(+) create mode 100644 library/Director/IcingaConfig/IcingaLegacyConfigHelper.php (limited to 'library/Director/IcingaConfig/IcingaLegacyConfigHelper.php') diff --git a/library/Director/IcingaConfig/IcingaLegacyConfigHelper.php b/library/Director/IcingaConfig/IcingaLegacyConfigHelper.php new file mode 100644 index 0000000..38d93ee --- /dev/null +++ b/library/Director/IcingaConfig/IcingaLegacyConfigHelper.php @@ -0,0 +1,110 @@ + doesn't work + '/\f/', + ]; + + $replace = [ + '\\\\\\', + '\\$', + '\\t', + '\\r', + '\\n', + // '\\b', + '\\f', + ]; + + $string = preg_replace($special, $replace, $string); + + return $string; + } + + /** + * @param array $array + * @return string + */ + public static function renderArray($array) + { + $data = []; + foreach ($array as $entry) { + if ($entry instanceof IcingaConfigRenderer) { + // $data[] = $entry; + $data[] = 'INVALID_ARRAY_MEMBER'; + } else { + $data[] = self::renderString($entry); + } + } + + return implode(', ', $data); + } + + public static function renderDictionary($dictionary) + { + return 'INVALID_DICTIONARY'; + } + + public static function renderExpression($string) + { + return 'INVALID_EXPRESSION'; + } + + public static function alreadyRendered($string) + { + return new IcingaConfigRendered($string); + } + + public static function renderInterval($interval) + { + if ($interval < 60) { + $interval = 60; + } + return $interval / 60; + } +} -- cgit v1.2.3