-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsingleton.php
More file actions
46 lines (29 loc) · 795 Bytes
/
singleton.php
File metadata and controls
46 lines (29 loc) · 795 Bytes
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
<?php
class Settings {
static private $box;
private $settings;
private final function __construct()
{
$this->settings = parse_ini_file('app.ini');
}
static public function getBox()
{
if (is_null(static::$box)) {
static::$box = new static();
}
return static::$box;
}
public function getHost() {
return $this->settings['host'];
}
public function getUser() {
return $this->settings['user'];
}
public function getPass() {
return $this->settings['password'];
}
public function getDbName() {
return $this->settings['dbName'];
}
}
echo $dbHost = Settings::getBox()->getHost();