-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathConfig.php
73 lines (61 loc) · 1.54 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
namespace Racine;
class Config
{
/**
* @var Config
*/
private static $instance = null;
private function __construct()
{
$configDirectories = [_CONFIG_DIR_];
}
protected static function getInstance()
{
if(is_null(self::$instance)){
self::$instance = new self();
}
return self::$instance;
}
public static function get($filename, $objectForMap = false, $ext = "php")
{
$config = require self::getConfigDir().DIRECTORY_SEPARATOR.$filename.'.'.$ext;
if($objectForMap){
$config = json_decode(json_encode($config), false);
}
return $config;
/* try{
$items = Yaml::parse(
file_get_contents(self::getConfigDir().DIRECTORY_SEPARATOR.$filename.'.yml'),
true, true, $objectForMap
);
return $items;
}catch (ParseException $exception){
printf("Unable to parse the YAML string: %s", $exception->getMessage());
return false;
} */
}
public static function getResourcesDir()
{
return _RESOURCES_DIR_;
}
public static function getAppDir()
{
return _APP_DIR_;
}
/**
* @return string
*/
public static function getViewsDir()
{
return _VIEWS_DIR_;
}
public static function getConfigDir()
{
return _CONFIG_DIR_;
}
public static function getPublicDir()
{
return _PUBLIC_DIR_;
}
}