-
Notifications
You must be signed in to change notification settings - Fork 47
/
Config.php
45 lines (36 loc) · 1.1 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
<?php
namespace Gerencianet;
class Config
{
public static function get($property)
{
$file = file_get_contents(__DIR__.'/config.json');
$config = json_decode($file, true);
if (isset($config[$property])) {
return $config[$property];
}
return;
}
public static function options($options)
{
$conf = [];
$conf['sandbox'] = isset($options['sandbox']) ? $options['sandbox'] : false;
$conf['debug'] = isset($options['debug']) ? $options['debug'] : false;
if (isset($options['client_id'])) {
$conf['clientId'] = $options['client_id'];
}
if (isset($options['client_secret'])) {
$conf['clientSecret'] = $options['client_secret'];
}
if (isset($options['url'])) {
$conf['baseUri'] = $options['url'];
} else {
$config = self::get('URL');
$conf['baseUri'] = $config['production'];
if ($conf['sandbox']) {
$conf['baseUri'] = $config['sandbox'];
}
}
return $conf;
}
}