-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathConfig.php
More file actions
42 lines (31 loc) · 908 Bytes
/
Copy pathConfig.php
File metadata and controls
42 lines (31 loc) · 908 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
<?php namespace Mirage;
class Config {
static $override = array();
/**
* Get parameter from config file, using "dot" style, ex: web.db_name(/app/config/web.php, param "db_name")
*
* @param string $id Allowed db.user, web.path, etc.
* @return string
*/
static function get($id) {
if(empty($id)) {
return false;
}
list($file, $param) = explode(".", $id, 2);
if(file_exists(App::get('app_dir')."/config/".$file.".php")) {
$params = require(App::get('app_dir')."/config/".$file.".php");
$value = !empty($params[$param]) ? $params[$param] : false;
return $value;
}
return false;
}
/**
* Overrides given configuration in run-time only, will not actually affect config file
*
* @param string $id Allowed methods, | delimited
* @param string $value A route pattern such as /about/system
* @return string|object
*/
static function set($id, $value) {
}
}