-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathConfig.php
73 lines (63 loc) · 1.96 KB
/
Config.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<?php
class Config {
private static $dbConfig = array();
private static $defaultDbConfig = "";
public function __construct() {
}
public static function setDbConfig($dbConfig=null) {
if (!$dbConfig) {
static::$dbConfig = array(
"Default"=>array(
"database" => "MySQL",
"host" => "localhost",
"user" => "root",
"password" => "",
"dbName" => "testdbs"
),
"Production"=>array(
"database" => "MySQL",
"host" => "localhost",
"user" => "root",
"password" => "",
"dbName" => "testdbs"
),
"Development"=>array(
"database" => "MySQL",
"host" => "localhost",
"user" => "root",
"password" => "",
"dbName" => "testdbs"
),
"Test"=>array(
"database" => "MySQL",
"host" => "localhost",
"user" => "root",
"password" => "",
"dbName" => "testdbs"
)
);
} else {
static::$dbConfig = $dbConfig;
}
}
public static function getDbConfig() {
if (!static::$dbConfig) {
static::setDbConfig();
}
return static::$dbConfig;
}
public static function setDefaultDbConfig($defaultDbConfig=null){
if(!$defaultDbConfig){
static::$defaultDbConfig = "Default";
}else{
static::$defaultDbConfig = $defaultDbConfig;
}
}
public static function getDefaultDbConfig(){
if(!static::$defaultDbConfig){
static::setDefaultDbConfig();
}
return static::$defaultDbConfig;
}
}
?>