1 | <?php |
||
7 | class Config |
||
8 | { |
||
9 | protected $db; |
||
10 | protected $config = []; |
||
11 | protected $table_config = 'config'; |
||
12 | |||
13 | /** |
||
14 | * Constructor |
||
15 | * @param Database $db This should be an instance of the database class |
||
16 | * @param string $config_table If the config table is different from the default set this here |
||
17 | */ |
||
18 | 5 | public function __construct(Database $db, $config_table = 'config') |
|
33 | |||
34 | /** |
||
35 | * Get the config value for a given setting |
||
36 | * @param string $setting This should be the name of the setting that you wish to retrieve |
||
37 | * @return mixed The setting value if it exists will be returned |
||
38 | */ |
||
39 | 2 | public function __get($setting) |
|
43 | |||
44 | /** |
||
45 | * Return all of the settings |
||
46 | * @return array All of the settings will be returned |
||
47 | */ |
||
48 | 3 | public function getAll() |
|
52 | |||
53 | /** |
||
54 | * Updates a config setting temporarily |
||
55 | * @param string $setting This should be the setting name |
||
56 | * @param mixed $value The new value for the setting should be added here |
||
57 | * @return $this |
||
58 | */ |
||
59 | 1 | public function __set($setting, $value) |
|
63 | /** |
||
64 | * Updates a config setting temporarily |
||
65 | * @param string $setting This should be the setting name |
||
66 | * @param mixed $value The new value for the setting should be added here |
||
67 | * @return $this |
||
68 | */ |
||
69 | 2 | public function set($setting, $value) |
|
74 | |||
75 | /** |
||
76 | * Set a setting in the database |
||
77 | * @param string $setting This should be the setting name |
||
78 | * @param mixed $value The new value for the setting should be added here |
||
79 | * @return $this |
||
80 | */ |
||
81 | 1 | public function update($setting, $value) |
|
88 | } |
||
89 |