1 | <?php |
||
11 | class Config{ |
||
|
|||
12 | |||
13 | /** |
||
14 | * Array of configurations |
||
15 | * |
||
16 | * @var array |
||
17 | */ |
||
18 | private static $config = []; |
||
19 | |||
20 | /** |
||
21 | * Prefixes used to load specific configurations. |
||
22 | * |
||
23 | * @var array |
||
24 | */ |
||
25 | private static $prefix = [ |
||
26 | 'default' => 'config', |
||
27 | 'js' => 'javascript' |
||
28 | ]; |
||
29 | |||
30 | /** |
||
31 | * Get default configuration value(s) |
||
32 | * |
||
33 | * @param $key string |
||
34 | * @return string|array|null |
||
35 | */ |
||
36 | public static function get($key){ |
||
39 | |||
40 | /** |
||
41 | * Set or add a default configuration value |
||
42 | * |
||
43 | * @param $key string |
||
44 | */ |
||
45 | public static function set($key, $value){ |
||
48 | |||
49 | /** |
||
50 | * Get javascript configuration value(s) |
||
51 | * |
||
52 | * @param $key string |
||
53 | * @return string|array|null |
||
54 | */ |
||
55 | public static function getJsConfig($key = ""){ |
||
58 | |||
59 | /** |
||
60 | * Set or add a javascript configuration value |
||
61 | * |
||
62 | * @param string $key |
||
63 | * @param mixed $value |
||
64 | */ |
||
65 | public static function setJsConfig($key, $value){ |
||
68 | |||
69 | /** |
||
70 | * Get a configuration value(s) |
||
71 | * |
||
72 | * @param $key string |
||
73 | * @param $source string |
||
74 | * @return string|null |
||
75 | * @throws Exception if configuration file doesn't exist |
||
76 | */ |
||
77 | private static function _get($key, $source){ |
||
98 | |||
99 | /** |
||
100 | * Set or adds a configuration value |
||
101 | * |
||
102 | * @param $key string |
||
103 | * @param $value string |
||
104 | * @param $source string |
||
105 | */ |
||
106 | private static function _set($key, $value, $source){ |
||
117 | } |
||
118 |
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.