1 | <?php |
||
18 | class Config |
||
19 | { |
||
20 | public static $defaultConfig = [ |
||
21 | 'default_token' => null, |
||
22 | ]; |
||
23 | |||
24 | private $config; |
||
25 | private $configSource; |
||
26 | private $useEnvironment; |
||
27 | |||
28 | /** |
||
29 | * @param boolean $useEnvironment Use SLACK_CLI_ environment variables to replace config settings |
||
30 | */ |
||
31 | 5 | public function __construct($useEnvironment = true) |
|
37 | |||
38 | /** |
||
39 | * @param $source |
||
40 | */ |
||
41 | 5 | public function setConfigSource($source) |
|
45 | |||
46 | /** |
||
47 | * @return mixed |
||
48 | */ |
||
49 | public function getConfigSource() |
||
53 | |||
54 | /** |
||
55 | * Merges new config values with the existing ones (overriding) |
||
56 | * |
||
57 | * @param array $config |
||
58 | */ |
||
59 | 4 | public function merge($config) |
|
68 | |||
69 | /** |
||
70 | * Returns a setting |
||
71 | * |
||
72 | * @param string $key |
||
73 | * |
||
74 | * @throws \RuntimeException |
||
75 | * |
||
76 | * @return mixed |
||
77 | */ |
||
78 | 2 | public function get($key) |
|
91 | |||
92 | /** |
||
93 | * @return array |
||
94 | */ |
||
95 | 1 | public function all() |
|
104 | |||
105 | /** |
||
106 | * @return array |
||
107 | */ |
||
108 | 1 | public function raw() |
|
114 | |||
115 | /** |
||
116 | * Checks whether a setting exists |
||
117 | * |
||
118 | * @param string $key |
||
119 | * |
||
120 | * @return bool |
||
121 | */ |
||
122 | 2 | public function has($key) |
|
126 | |||
127 | /** |
||
128 | * Replaces {$refs} inside a config string |
||
129 | * |
||
130 | * @param string $value a config string that can contain {$refs-to-other-config} |
||
131 | * |
||
132 | * @return string |
||
133 | */ |
||
134 | private function process($value) |
||
146 | } |
||
147 |