summaryrefslogtreecommitdiffstats
path: root/library/Toplevelview/Monitoring/Options.php
diff options
context:
space:
mode:
Diffstat (limited to 'library/Toplevelview/Monitoring/Options.php')
-rw-r--r--library/Toplevelview/Monitoring/Options.php33
1 files changed, 33 insertions, 0 deletions
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 @@
+<?php
+/* Copyright (C) 2019 Icinga Development Team <info@icinga.com> */
+
+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;
+ }
+}