summaryrefslogtreecommitdiff
path: root/manager/library/config/Config.php
diff options
context:
space:
mode:
authorINOPIAE <inopiae@cacert.org>2015-08-09 19:12:51 +0200
committerBenny Baumann <BenBE@geshi.org>2015-08-09 22:23:21 +0200
commit4edd7b57c0057f9cfab0874a198256b87bd018b7 (patch)
tree2a623eade7fea29bda28e15692991821448c8fe1 /manager/library/config/Config.php
parentce38587c8459587d7a03002ebcb4427ed95fb85c (diff)
downloadcacert-mgr-4edd7b57c0057f9cfab0874a198256b87bd018b7.tar.gz
cacert-mgr-4edd7b57c0057f9cfab0874a198256b87bd018b7.tar.xz
cacert-mgr-4edd7b57c0057f9cfab0874a198256b87bd018b7.zip
bug 1396: Codestyle cleanup
Diffstat (limited to 'manager/library/config/Config.php')
-rw-r--r--manager/library/config/Config.php194
1 files changed, 97 insertions, 97 deletions
diff --git a/manager/library/config/Config.php b/manager/library/config/Config.php
index fe47ae6..2c315a6 100644
--- a/manager/library/config/Config.php
+++ b/manager/library/config/Config.php
@@ -3,101 +3,101 @@
require_once('config/Config_Db.php');
class Config {
- /**
- * static pointer to instances
- * @var array(Config)
- */
- private static $instances = array();
-
- /**
- * can handle several instances, distinct by instance name string
- * @var string
- */
- private $instanceName = '';
-
- /**
- * config object
- * @var Config_Db
- */
- private $config = null;
-
- /**
- * make a new Config_Db
- *
- * by using the $where statement you can limit the data that is fetched from db, i.e. only get config for zone $id
- *
- * @param string $instanceName
- * @param Zend_Db_Adapter $db
- * @param string $where
- */
- protected function __construct($instanceName = null, $db = null, $where = null) {
- if ($instanceName === null)
- throw new Exception(__METHOD__ . ': expected an instance name, got none');
-
- $config = new Zend_Config_Ini(APPLICATION_PATH . '/configs/application.ini', APPLICATION_ENV);
- $this->instanceName = $instanceName;
-
- if ($db === null)
- $db = Zend_Db::factory($config->dnssecme->db->config->pdo, $config->dnssecme->db->config);
-
- $this->config = new Config_Db($db, $instanceName, $where, true);
- }
-
- /**
- * get already existing instance, make new instance or throw an exception
- * @param string $instanceName
- * @param Zend_Db_Adapter $db
- * @param string $where
- */
- public static function getInstance($instanceName, $db = null, $where = null) {
- if ($instanceName === null)
- throw new Exception(__METHOD__ . ': expected an instance name, got none');
-
- // no caching if presumeably volatile data is requested
- if ($db !== null && $where !== null) {
- return new Config($instanceName, $db, $where);
- }
-
- if (!array_key_exists($instanceName, self::$instances)) {
- self::$instances[$instanceName] = new Config($instanceName, $db, $where);
- }
-
- return self::$instances[$instanceName];
- }
-
- /**
- * magic method that dispatches all unrecognized method calls to the config object
- *
- * @param string $param
- */
- public function __get($param) {
- return $this->config->$param;
- }
-
- /**
- * magic method that handles isset inquiries to attributes
- *
- * @param string $param
- */
- public function __isset($param) {
- return isset($this->config->$param);
- }
-
- /**
- * magic method that dispatches all unrecognized method calls to the config object
- *
- * @param string $param
- * @param string $value
- */
- public function __set($param, $value) {
- $this->config->$param = $value;
- }
-
- /**
- * get the config object
- * @return Zend_Config_*
- */
- public function getConfig() {
- return $this->config;
- }
+ /**
+ * static pointer to instances
+ * @var array(Config)
+ */
+ private static $instances = array();
+
+ /**
+ * can handle several instances, distinct by instance name string
+ * @var string
+ */
+ private $instanceName = '';
+
+ /**
+ * config object
+ * @var Config_Db
+ */
+ private $config = null;
+
+ /**
+ * make a new Config_Db
+ *
+ * by using the $where statement you can limit the data that is fetched from db, i.e. only get config for zone $id
+ *
+ * @param string $instanceName
+ * @param Zend_Db_Adapter $db
+ * @param string $where
+ */
+ protected function __construct($instanceName = null, $db = null, $where = null) {
+ if ($instanceName === null)
+ throw new Exception(__METHOD__ . ': expected an instance name, got none');
+
+ $config = new Zend_Config_Ini(APPLICATION_PATH . '/configs/application.ini', APPLICATION_ENV);
+ $this->instanceName = $instanceName;
+
+ if ($db === null)
+ $db = Zend_Db::factory($config->dnssecme->db->config->pdo, $config->dnssecme->db->config);
+
+ $this->config = new Config_Db($db, $instanceName, $where, true);
+ }
+
+ /**
+ * get already existing instance, make new instance or throw an exception
+ * @param string $instanceName
+ * @param Zend_Db_Adapter $db
+ * @param string $where
+ */
+ public static function getInstance($instanceName, $db = null, $where = null) {
+ if ($instanceName === null)
+ throw new Exception(__METHOD__ . ': expected an instance name, got none');
+
+ // no caching if presumeably volatile data is requested
+ if ($db !== null && $where !== null) {
+ return new Config($instanceName, $db, $where);
+ }
+
+ if (!array_key_exists($instanceName, self::$instances)) {
+ self::$instances[$instanceName] = new Config($instanceName, $db, $where);
+ }
+
+ return self::$instances[$instanceName];
+ }
+
+ /**
+ * magic method that dispatches all unrecognized method calls to the config object
+ *
+ * @param string $param
+ */
+ public function __get($param) {
+ return $this->config->$param;
+ }
+
+ /**
+ * magic method that handles isset inquiries to attributes
+ *
+ * @param string $param
+ */
+ public function __isset($param) {
+ return isset($this->config->$param);
+ }
+
+ /**
+ * magic method that dispatches all unrecognized method calls to the config object
+ *
+ * @param string $param
+ * @param string $value
+ */
+ public function __set($param, $value) {
+ $this->config->$param = $value;
+ }
+
+ /**
+ * get the config object
+ * @return Zend_Config_*
+ */
+ public function getConfig() {
+ return $this->config;
+ }
}