Credentials::__callStatic()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
cc 2
eloc 5
c 2
b 0
f 0
nc 2
nop 2
dl 0
loc 10
rs 10
1
<?php
2
3
/**
4
 * This class is provided for reference
5
 * Any application that want to use the Dolphin must provide the
6
 * Same functionality as this class provides e.g. Credentials::get('user').
7
 */
8
9
namespace App\Config;
10
11
class Credentials
12
{
13
    public static function __callStatic($name, $arguments)
14
    {
15
        $dbCredentials = require('database.php');
16
        $var = $arguments[0];
17
18
        if(array_key_exists($var, $dbCredentials)){
19
            return $dbCredentials[$var];
20
        }
21
22
        throw new \Exception("The requested key $var not found!", 1);
23
    }
24
}
25