From 1ac4a2050c8076eb96e07e83721ebc9db864db94 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 28 Apr 2024 14:47:21 +0200 Subject: Adding upstream version 0.3.3. Signed-off-by: Daniel Baumann --- library/Toplevelview/Monitoring/Options.php | 33 +++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 library/Toplevelview/Monitoring/Options.php (limited to 'library/Toplevelview/Monitoring/Options.php') diff --git a/library/Toplevelview/Monitoring/Options.php b/library/Toplevelview/Monitoring/Options.php new file mode 100644 index 0000000..75f739f --- /dev/null +++ b/library/Toplevelview/Monitoring/Options.php @@ -0,0 +1,33 @@ + */ + +namespace Icinga\Module\Toplevelview\Monitoring; + +trait Options +{ + protected $options = []; + + public function getOption($key) + { + if (array_key_exists($key, $this->options)) { + return $this->options[$key]; + } + + return null; + } + + public function setOptions($options, $flush = false) + { + if ($flush) { + $this->options = []; + } + + if (! empty($options)) { + foreach ($options as $k => $v) { + $this->options[$k] = $v; + } + } + + return $this; + } +} -- cgit v1.2.3