From 6d987d2c0ba8435a64843d42362851d40b277eec Mon Sep 17 00:00:00 2001 From: Christian Weiske Date: Tue, 4 Jan 2011 19:32:49 +0100 Subject: [PATCH] check that the hostname is configured --- Wrt3g/Config.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/Wrt3g/Config.php b/Wrt3g/Config.php index 5036f7d..fc058ed 100644 --- a/Wrt3g/Config.php +++ b/Wrt3g/Config.php @@ -102,6 +102,8 @@ class Wrt3g_Config 2 ); + $this->verify(); + if (isset($options['save'])) { $this->save($file); } @@ -201,6 +203,22 @@ class Wrt3g_Config $this->logger->log('Saving config into file ' . $file, 2); $cfg->writeConfig($file, 'inifile'); } + + + + /** + * Verifies that all required options are set + * + * @return void + * + * @throw Exception When something is missing + */ + protected function verify() + { + if ($this->host == '') { + throw new Exception('Hostname missing'); + } + } } ?> \ No newline at end of file -- 2.30.2