1 | <?php |
||
9 | class Database |
||
10 | { |
||
11 | use SingletonTrait; |
||
12 | |||
13 | /** |
||
14 | * The default PDO connection options. |
||
15 | * |
||
16 | * @var array |
||
17 | */ |
||
18 | protected $options = [ |
||
19 | PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, |
||
20 | PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_OBJ |
||
21 | ]; |
||
22 | |||
23 | /** |
||
24 | * Connect to the appropriate database |
||
25 | * based on the details specified in |
||
26 | * the configuration file. |
||
27 | * |
||
28 | * @param array $config |
||
29 | * @return PDO|bool |
||
30 | */ |
||
31 | public function connection(array $config) |
||
39 | |||
40 | /** |
||
41 | * Load the configuration. |
||
42 | * |
||
43 | * @param array $config |
||
44 | * @return string |
||
45 | */ |
||
46 | public function loadConfig(array $config) |
||
57 | } |
||
58 |