Conditions | 2 |
Paths | 2 |
Total Lines | 13 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 6 |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
23 | public static function getConnection() |
||
24 | { |
||
25 | // defaults |
||
26 | $ret = ['uri' => null, 'db' => 'db']; |
||
27 | |||
28 | if (isset($_ENV['VCAP_SERVICES'])) { |
||
29 | $path = new JSONPath(json_decode($_ENV['VCAP_SERVICES'], true)); |
||
30 | $ret['uri'] = $path->find('$..mongodb[0].*.uri')->first(); |
||
31 | $ret['db'] = $path->find('$..mongodb[0].*.database')->first(); |
||
32 | } |
||
33 | |||
34 | return $ret; |
||
35 | } |
||
36 | } |
||
37 |